{"id":13513657,"url":"https://github.com/damln/localtower","last_synced_at":"2025-04-12T06:14:28.553Z","repository":{"id":18453599,"uuid":"84344103","full_name":"damln/localtower","owner":"damln","description":"The first UI to manage your Rails DB migrations.","archived":false,"fork":false,"pushed_at":"2023-01-26T20:19:03.000Z","size":4038,"stargazers_count":408,"open_issues_count":0,"forks_count":22,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-05-22T16:32:23.048Z","etag":null,"topics":["activerecord","database","postgres","rails","ruby","schema"],"latest_commit_sha":null,"homepage":"","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/damln.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-08T16:47:54.000Z","updated_at":"2024-03-14T08:42:50.000Z","dependencies_parsed_at":"2023-02-14T23:16:47.134Z","dependency_job_id":null,"html_url":"https://github.com/damln/localtower","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damln%2Flocaltower","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damln%2Flocaltower/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damln%2Flocaltower/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damln%2Flocaltower/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/damln","download_url":"https://codeload.github.com/damln/localtower/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525138,"owners_count":21118619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["activerecord","database","postgres","rails","ruby","schema"],"created_at":"2024-08-01T05:00:34.046Z","updated_at":"2025-04-12T06:14:28.533Z","avatar_url":"https://github.com/damln.png","language":"CSS","funding_links":[],"categories":["JavaScript","CSS"],"sub_categories":[],"readme":"![Gem](https://img.shields.io/gem/v/localtower) ![Gem](https://img.shields.io/gem/dt/localtower?label=gem%20downloads)\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/damln/localtower/master/public/com/twitter-cover-3.png\" alt=\"Localtower\"\u003e\n\u003c/p\u003e\n\n## Introduction\n\n![New Model](https://raw.githubusercontent.com/damln/localtower/master/public/screenshots/v2.0.0/Screenshot%202024-11-18%20at%2022.44.30.jpg)\n\n**- What is Localtower?**\n\nLocaltower is a Rails Engine mountable in development environment to help you generate migrations for your Rails application.\nIt's like ActiveAdmin or Sidekiq UI.\nYou plug it in your `config/routes.rb` and it works out of the box.\nCheck the _Installation_ section below for more details.\n\n**- How Localtower works?**\n\nLocaltower gives you a UI to create models and migrations. It will generate a migration file like you would do with `rails generate migration add_index_to_users`. You will see the generated file in `db/migrate/` folder.\n\n**- Why creating a UI for Rails migrations?**\n\nRails migrations are well documented in the official [Rails Guides](https://guides.rubyonrails.org/active_record_migrations.html) but we often tend to forget some commands or do typo errors. Like writing `add_index :user, :email` instead of `add_index :users, :email` (did you spot the typo?). Working from a UI with a fixed list of commands reduces the chance of making errors.\n\n**- When I'm using Localtower, can I still generate migrations from the command line?**\n\nOf course! Localtower does not lock you up. You can still generate migrations like you did before. Localtower is just a migration generator. You can also generate a migration from Localtower and then edit it manually before running `rails db:migrate`\n\n**- What does happen when I want to remove Localtower?**\n\nYou just have to remove the gem from your `Gemfile`, run `bundle`, remove the engine in `config/routes.rb`, and that's it! All your previous migrations will stay in `db/migrate/`. You are never locked up with Localtower. You can install or uninstall anytime. Remember, it is just a UI to generate files. Do not hesitate to [open an issue on Github](https://github.com/damln/localtower/issues) and tell me why you don't want it anymore. It will be very valuable for me to understand what I can do better ❤.\n\n**- Cool, but there are some migration options that are not available in Localtower, what can I do?**\n\nLocaltower doesn't implement all the Rails Migrations API. I focused on the most common scenarios. If you need to do something tricky in your migrations, you can still edit the migrations manually. You are also welcome to [open an issue on Github](https://github.com/damln/localtower/issues) to ask for a specific feature. I'm always open to extend the possibilities of Localtower.\n\n## Screenshots\n\n### Create a model\n\n![New Model](https://raw.githubusercontent.com/damln/localtower/master/public/screenshots/v2.0.0/Screenshot%202024-11-18%20at%2022.44.30.jpg)\n\n### Create a migration\n\n![New Migration](https://raw.githubusercontent.com/damln/localtower/master/public/screenshots/v2.0.0/Screenshot%202024-11-18%20at%2022.48.21.jpg)\n\n### See the Migrations (and migrate)\n\n![Migrations](https://raw.githubusercontent.com/damln/localtower/master/public/screenshots/v2.0.0/Screenshot%202024-11-18%20at%2022.50.11.jpg)\n\n## Installation\n\nPlease use the best localtower version: `\u003e= 2`\nSee installation process below.\n\nCompatibility:\n\n- Rails \u003e= 5.2\n- Ruby \u003e= 2.3\n\nAdd to your `Gemfile` file:\n\n```ruby\ngroup :development do\n  gem 'localtower', '~\u003e 2'\nend\n```\n\nRun command in your terminal:\n\n```bash\nbundle install\n```\n\nAdd to your `config/routes.rb`:\n\n```ruby\nMyApp::Application.routes.draw do\n  if Rails.env.development?\n    mount Localtower::Engine, at: 'localtower'\n  end\n\n  # Your other routes here:\n  # ...\nend\n```\n\n**⚠ IMPORTANT ⚠**\n\nChange your config/environments/development.rb:\n\n```ruby\nRails.application.configure do\n  # This is the default:\n  # config.active_record.migration_error = :page_load\n\n  # Change it to:\n  config.active_record.migration_error = false if defined?(Localtower)\n\n  # ...\nend\n```\n\nIf you know how to override this configuration in the gem instead of doing it in your app code, please open an issue and tell me your solution.\n\n## Usage\n\nTo access the UI, run your local rails server and open your browser at [http://localhost:3000/localtower](http://localhost:3000/localtower).\n\n## Full scenario\n\n### Demo (2min)\n\n[![Localtower v2 demo](https://raw.githubusercontent.com/damln/localtower/master/public/com/localtower-play.png)](https://www.youtube.com/watch?v=Bd01fm3xuko)\n\n### Create a model\n\n![](https://raw.githubusercontent.com/damln/localtower/master/public/screenshots/v2.0.0/Screenshot%202024-11-18%20at%2022.44.30.jpg)\n\nIt will create a migration file:\n\n![](https://raw.githubusercontent.com/damln/localtower/master/public/screenshots/v2.0.0/Screenshot%202024-11-18%20at%2022.44.42.jpg)\n\n### Create a migration\n\n![](https://raw.githubusercontent.com/damln/localtower/master/public/screenshots/v2.0.0/Screenshot%202024-11-18%20at%2022.48.21.jpg)\n\nIt will generate a migration file:\n\n![](https://raw.githubusercontent.com/damln/localtower/master/public/screenshots/v2.0.0/Screenshot%202024-11-18%20at%2022.48.51.jpg)\n\n### Create another model\n\nNow, we add a `Book` model:\n\n![](https://raw.githubusercontent.com/damln/localtower/master/public/screenshots/v2.0.0/Screenshot%202024-11-18%20at%2022.50.04.jpg)\n\n### All the migrations generated\n\n![](https://raw.githubusercontent.com/damln/localtower/master/public/screenshots/v2.0.0/Screenshot%202024-11-18%20at%2022.50.19.jpg)\n\n### Files generated\n\nEvery action made from the UI will generate native Rails migration files.\nExactly like the `rails generate` command.\nBut instead of generating files in the console, they are generated in the `db/migrate` folder.\n\n- The models:\n![](https://raw.githubusercontent.com/damln/localtower/master/public/screenshots/v2.0.0/Screenshot%202024-11-18%20at%2022.51.47.jpg)\n![](https://raw.githubusercontent.com/damln/localtower/master/public/screenshots/v2.0.0/Screenshot%202024-11-18%20at%2022.51.48.jpg)\n\n- The migration files:\n![](https://raw.githubusercontent.com/damln/localtower/master/public/screenshots/v2.0.0/Screenshot%202024-11-18%20at%2022.52.18.jpg)\n![](https://raw.githubusercontent.com/damln/localtower/master/public/screenshots/v2.0.0/Screenshot%202024-11-18%20at%2022.52.26.jpg)\n\n- The final schema:\n![](https://raw.githubusercontent.com/damln/localtower/master/public/screenshots/v2.0.0/Screenshot%202024-11-18%20at%2022.52.38.jpg)\n\n\n## Upgrading\n\nI recommend you to upgrade to the latest version which is `2.X.X`.\nBe sure you have this in your `Gemfile`:\n```ruby\ngroup :development do\n  gem 'localtower', '~\u003e 2'\nend\n```\n\nTo upgrade, just use the latest version of Localtower.\n\n```\nbundle update localtower\n```\n\nThen restart your server.\n\n## Contribute\n\nThanks for reporting issues, I'll do my best to fix the bugs 💪\n\n![ga](https://www.google-analytics.com/collect?v=1\u0026tid=G-1XG3EBE2DZ\u0026cid=555\u0026aip=1\u0026t=event\u0026ec=github\u0026ea=visit\u0026dp=readme\u0026dt=gem)\n\n## Run test\n\nIf you want to contribute to the gem:\n\nCreate a `spec/dummy/.env` file with the credentials to your PostgreSQL Database. It should look like this:\n\n```\nLOCALTOWER_PG_USERNAME=\"admin\"\nLOCALTOWER_PG_PASSWORD=\"root_or_smething\"\n```\n\ndrop / create database:\n\n```bash\ncd spec/dummy\nbundle exec rails db:drop\nbundle exec rails db:create\nrm app/models/*.rb\n```\n\nRun the spec:\n\n```bash\nbundle install\nbundle exec rspec spec/\n```\n\n## Deploy latest gem version\n\nOnly for official contributors.\n\n    git tag vX.X.X # change by last version\n    git push --tags\n    rm *.gem\n    gem build localtower.gemspec\n    gem push localtower-*.gem\n\n## Notes\n\nDo not hesitate to open issues if you have troubles using the gem.\n\n- By Damian Le Nouaille:\n  - Twitter: https://twitter.com/damian_lnd\n  - Website: https://damln.com\n- Link on RubyGems.org: https://rubygems.org/gems/localtower\n- Stats on BestGems.org (30k+ downloads): https://bestgems.org/gems/localtower\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamln%2Flocaltower","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdamln%2Flocaltower","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamln%2Flocaltower/lists"}