{"id":13532823,"url":"https://github.com/jalkoby/squasher","last_synced_at":"2025-05-13T16:06:19.564Z","repository":{"id":13364692,"uuid":"16052303","full_name":"jalkoby/squasher","owner":"jalkoby","description":"Squasher - squash your old migrations in a single command","archived":false,"fork":false,"pushed_at":"2024-12-16T19:31:17.000Z","size":104,"stargazers_count":1514,"open_issues_count":5,"forks_count":57,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-10T19:47:41.996Z","etag":null,"topics":["activerecord-migrations","database","ruby","schema"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jalkoby.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-01-19T19:10:55.000Z","updated_at":"2025-03-24T10:16:57.000Z","dependencies_parsed_at":"2023-01-13T17:26:23.821Z","dependency_job_id":"ef5831cb-83e7-4759-9147-a462321572d6","html_url":"https://github.com/jalkoby/squasher","commit_stats":{"total_commits":83,"total_committers":20,"mean_commits":4.15,"dds":0.6385542168674698,"last_synced_commit":"b5e3b928c68da7df809946c9f364d70f02cb5039"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jalkoby%2Fsquasher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jalkoby%2Fsquasher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jalkoby%2Fsquasher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jalkoby%2Fsquasher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jalkoby","download_url":"https://codeload.github.com/jalkoby/squasher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250512853,"owners_count":21443103,"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-migrations","database","ruby","schema"],"created_at":"2024-08-01T07:01:14.033Z","updated_at":"2025-04-23T20:39:53.601Z","avatar_url":"https://github.com/jalkoby.png","language":"Ruby","readme":"# Squasher\n\n[![CI](https://github.com/jalkoby/squasher/actions/workflows/ci.yml/badge.svg)](https://github.com/jalkoby/squasher/actions/workflows/ci.yml)\n[![Code Climate](https://codeclimate.com/github/jalkoby/squasher.svg)](https://codeclimate.com/github/jalkoby/squasher)\n[![Gem Version](https://badge.fury.io/rb/squasher.svg)](http://badge.fury.io/rb/squasher)\n\nSquasher compresses old ActiveRecord migrations. If you work on a big project with lots of migrations, every `rake db:migrate` might take a few seconds, or creating of a new database might take a few minutes. That's because ActiveRecord loads all those migration files. Squasher removes all the migrations and creates a single migration with the final database state of the specified date (the new migration will look like a schema).\n\n## Attention\nPrior to 0.6.2 squasher could damage your real data as generate \"force\" tables. Please upgrade to 0.6.2+ \u0026 manually clean \"force\" tag from the init migration\n\n## Installation\n\nYou don't have to add it into your Gemfile. Just a standalone installation:\n\n    $ gem install squasher\n\n**@note** if you use Rbenv don't forget to run `rbenv rehash`.\n\nIf you want to share it with your rails/sinatra/etc app add the below:\n\n```ruby\n# Yep, the missing group in most Gemfiles where all utilities should be!\ngroup :tools do\n  gem 'squasher', '\u003e= 0.6.0'\n  gem 'capistrano'\n  gem 'rubocop'\nend\n```\n\nDon't forget to run `bundle`.\n\nTo integrate `squasher` with your app even more do the below:\n\n    $ bundle binstub squasher\n    $ # and you have a runner inside the `bin` folder\n    $ bin/squasher\n\n## Usage\n\n**@note** stop all preloading systems if there are present (spring, zeus, etc)\n\nSuppose your application was created a few years ago. `%app_root%/db/migrate` folder looks like this:\n```bash\n2012...._first_migration.rb\n2012...._another_migration.rb\n# and a lot of other files\n2013...._adding_model_foo.rb\n# few years later\n2016...._removing_model_foo.rb\n# and so on\n```\n\nStoring these atomic changes over time is painful and useless. It's time to archive this history. Once you install the gem you can run the `squasher` command. For example, you want to compress all migrations which were created prior to the year 2017:\n\n    $ squasher 2017        # rails 3 \u0026 4\n    $ squasher 2017 -m 5.0 # rails 5+\n\nYou can tell `squasher` a more detailed date, for example:\n\n    $ squasher 2016/12    # prior to December 2016\n    $ squasher 2016/12/19 # prior to 19 December 2016\n\n### Options\n\nRun `squasher -h` or just `squasher` to see how you can use squasher:\n\n- in sql schema rails app\n- in rails 5+ app\n- inside an engine\n- in \"dry\" mode\n- in \"reuse\" mode\n\n## Requirements\n\nIt works and was tested on Ruby 2.0+ and ActiveRecord 3.1+. It also requires a valid development configuration in `config/database.yml`.\nIf an old migration inserted data (created ActiveRecord model records) you will lose this code in the squashed migration, **BUT** `squasher` will ask you to leave a tmp database which will have all data that was inserted while migrating. Using this database you could add that data as another migration, or into `config/seed.rb` (the expected place for this stuff).\n\n## Changelog\n\nAll changes are located in [the changelog file](CHANGELOG.md) with contribution notes\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","funding_links":[],"categories":["Ruby","Gems","Awesome Ruby CLIs"],"sub_categories":["Rails","Database"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjalkoby%2Fsquasher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjalkoby%2Fsquasher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjalkoby%2Fsquasher/lists"}