This message was imported from the Ruby/Rails Modularity Slack server. Find more info in the import thread.
Message originally sent by slack user U719UPXQ17B
Hello, how do I rename a column with strong migration enabled ? Can anyone help me out?
This message was imported from the Ruby/Rails Modularity Slack server. Find more info in the import thread.
Message originally sent by slack user U719UPXQ17B
Hello, how do I rename a column with strong migration enabled ? Can anyone help me out?
Message originally sent by slack user U78DXEZQGHX
The gems documentation is incredibly detailed and offers an example for this exact scenario.
https://github.com/ankane/strong_migrations#renaming-a-column
Have you tried that.
Message originally sent by slack user U78HE411QT1
I ran into this very issue recently. The gem does explain how the check can be disabled, but it wasn’t clear where to do this.
It would be nice if you could do it with an ENV variable like DISABLE_SOME_CHECK=true rails db:migrate
Instead I ended up doing this in my migration
def change
StrongMigrations.disable_check(:rename_column)
rename_column :my_table, :old_name, :new_name
end
Message originally sent by slack user U70VX2ZGM4Q
<@U78HE411QT1> you can do safety_assured do ; ... end
if you’re sure it’s safe. ( you can find documentation about this in the README https://github.com/ankane/strong_migrations#assuring-safety)
Message originally sent by slack user U78HE411QT1
Thanks <@U70VX2ZGM4Q> - for some reason I conflated this with another one of ankane’s gems: https://github.com/ankane/safely. I will try that next time.