squasher
squasher copied to clipboard
Use Rails 7 migrations by default
@jalkoby
Would you be happy to merge a PR implementing this feature request? :slightly_smiling_face:
Hi @blackst0ne , yes it makes sense as rails 5+ is only maintained. so please do it
Any news?
When generating migrations, the [5.2]
after < ActiveRecord::Migration
is not added, blocking automatic migrations. It's easy to add it by hand afterwards, but would be nice if it was already there.
Thanks for the very nice gem!
Any plan for such an easy fix guys?
Ok, actually found out giving an argument on the command line fixes the issue: --migration=5.0
. Going to 6.0
doesn't seem to work, but not a problem :)
not yet, don't have time at the moment
@jalkoby Maybe I could help with a PR? I'd just need some directions on which files to update / change.
sorry for a long response. here's a thing - the next major release should rework the whole concept of squasher. instead to be an automated shell script(driven by ruby) it will be an integrated rake wrapper which will hack the core rails schema generation tasks. so I don't think it's a good idea to tweak the existent code
@jalkoby hey! Any news about the next major release date?
Just installed the gem, and ran squasher clean
in a Rails 7 project, and got:
rake aborted!
StandardError: Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Active Record release the migration was written for:
class SquasherClean < ActiveRecord::Migration[7.0]
/Users/pboling/src/command_center/db/migrate/20230213193907_squasher_clean.rb:1:in `<main>'
/Users/pboling/.asdf/installs/ruby/2.7.7/bin/bundle:25:in `load'
/Users/pboling/.asdf/installs/ruby/2.7.7/bin/bundle:25:in `<main>'
Question: Does this gem still work?
Answer: Maybe? But... you need to run:
squasher clean --migration=7.0
Or, at least it doesn't raise an error that way. It also doesn't remove the squashed migrations, which I was expecting it to do... Actually it didn't do anything it should have.
So then I tried:
❯ squasher 2023 --migration=7.0
Squasher is creating a tmp database
rake aborted!
ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter
/Users/pboling/src/command_center/config/environment.rb:5:in `<main>'
/Users/pboling/.asdf/installs/ruby/2.7.7/bin/bundle:25:in `load'
/Users/pboling/.asdf/installs/ruby/2.7.7/bin/bundle:25:in `<main>'
The strange thing is, my database configuration does specify an adapter, but perhaps this gem can't handle the multi-db style yaml config?
Seems to be not working with Rails 7.
running into the same bug with a multi db yaml
This solution works for me in Rails 7:
squasher 2023 --migration=7.0