palkan / logidze

Database changes log for Rails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mutiple Update Migrations Have the Same Name

jonathan-wondereur opened this issue · comments

Tell us about your environment

Ruby Version:
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux]

Rails Version:
Rails 5.2.4.2

PostgreSQL Version:
9.6.16

Logidze Version:
0.12

What did you do?

I Generated an update migration for a table & ran it.

What did you expect to happen?

The migration to run with no problems. Each migration to get a unique class name.

What actually happened?

The migration did not run as it had a duplicate name with another migration of the same table.

root@api:/myapp# rake db:migrate
I, [2020-09-23T11:44:04.375968 #557]  INFO -- sentry: ** [Raven] Raven 3.0.0 ready to catch errors
SHRINE DEPRECATION WARNING: The logging plugin has been deprecated in favor of instrumentation plugin. The logging plugin will be removed in Shrine 3.
rake aborted!
ActiveRecord::DuplicateMigrationNameError: 

Multiple migrations have the name UpdateLogidzeForInstitutions.

/usr/local/bundle/gems/activerecord-5.2.4.2/lib/active_record/migration.rb:1316:in `validate'
/usr/local/bundle/gems/activerecord-5.2.4.2/lib/active_record/migration.rb:1185:in `initialize'
/usr/local/bundle/gems/activerecord-5.2.4.2/lib/active_record/migration.rb:1036:in `new'
/usr/local/bundle/gems/activerecord-5.2.4.2/lib/active_record/migration.rb:1036:in `up'
/usr/local/bundle/gems/activerecord-5.2.4.2/lib/active_record/migration.rb:1011:in `migrate'
/usr/local/bundle/gems/activerecord-5.2.4.2/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/usr/local/bundle/gems/activerecord-5.2.4.2/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <top (required)>'
/usr/local/bundle/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

Thanks for reporting!

I added a --name option in #168 to specify the migration name to avoid the conflicts.