You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can rename a model, and running hobo g migration gets the table rename perfectly. However, the migration fails when there is a relationship with foreign keys in that table because of index issues.
in this example, I re-named "cards" to "postcards":
-- add_index(:postcards, [:owner_id])
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
Index name 'index_postcards_on_owner_id' on table 'postcards' already exists/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.10.rc1/lib/active_record/connection_adapters/abstract/schema_statements.rb:819:in `add_index_options'
The text was updated successfully, but these errors were encountered:
mdkarp: does the migration succeed if you rearrange the migration statements so that the "drop indexes" happen before the "rename indexes" happens before the "add indexes"?
If so, this is a example of a larger problem where the drop indexes are done too late in the migration file.
You can rename a model, and running hobo g migration gets the table rename perfectly. However, the migration fails when there is a relationship with foreign keys in that table because of index issues.
in this example, I re-named "cards" to "postcards":
-- add_index(:postcards, [:owner_id])
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
Index name 'index_postcards_on_owner_id' on table 'postcards' already exists/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.10.rc1/lib/active_record/connection_adapters/abstract/schema_statements.rb:819:in `add_index_options'
The text was updated successfully, but these errors were encountered: