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
my migration failed because, well, I designed my table properly..
== TIMESTAMP AddDeviseToUsers: migrating =================================
-- change_table(:users)
bin/rails aborted!
StandardError: An error has occurred, this and all later migrations canceled: (StandardError)
PG::DuplicateColumn: ERROR: column "email" of relation "users" already exists
/path/to/project/db/migrate/TIMESTAMP_add_devise_to_users.rb:7:in 'block in AddDeviseToUsers.up'
/path/to/project/db/migrate/TIMESTAMP_add_devise_to_users.rb:5:in 'AddDeviseToUsers.up'
Caused by:
ActiveRecord::StatementInvalid: PG::DuplicateColumn: ERROR: column "email" of relation "users" already exists (ActiveRecord::StatementInvalid)
/path/to/project/db/migrate/TIMESTAMP_add_devise_to_users.rb:7:in 'block in AddDeviseToUsers.up'
/path/to/project/db/migrate/TIMESTAMP_add_devise_to_users.rb:5:in 'AddDeviseToUsers.up'
Caused by:
PG::DuplicateColumn: ERROR: column "email" of relation "users" already exists (PG::DuplicateColumn)
/path/to/project/db/migrate/TIMESTAMP_add_devise_to_users.rb:7:in 'block in AddDeviseToUsers.up'
/path/to/project/db/migrate/TIMESTAMP_add_devise_to_users.rb:5:in 'AddDeviseToUsers.up'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
and
== TIMESTAMP AddDeviseToUsers: migrating =================================
-- change_table(:users)
-> 0.0444s
-- add_index(:users, :email, {unique: true})
bin/rails aborted!
StandardError: An error has occurred, this and all later migrations canceled: (StandardError)
PG::DuplicateTable: ERROR: relation "index_users_on_email" already exists
/path/to/project/db/migrate/TIMESTAMP_add_devise_to_users.rb:39:in 'AddDeviseToUsers.up'
Caused by:
ActiveRecord::StatementInvalid: PG::DuplicateTable: ERROR: relation "index_users_on_email" already exists (ActiveRecord::StatementInvalid)
/path/to/project/db/migrate/TIMESTAMP_add_devise_to_users.rb:39:in 'AddDeviseToUsers.up'
Caused by:
PG::DuplicateTable: ERROR: relation "index_users_on_email" already exists (PG::DuplicateTable)
/path/to/project/db/migrate/TIMESTAMP_add_devise_to_users.rb:39:in 'AddDeviseToUsers.up'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
It's not that big of a thing as the fix is quite trivial, but I feel like this shouldn't happen in the first place.
My proposed fix would be to add some checks in: lib/generators/active_record/templates/migration_existing.rb
I've been using Devise for years and today, for
my migration failed because, well, I designed my table properly..
and
It's not that big of a thing as the fix is quite trivial, but I feel like this shouldn't happen in the first place.
My proposed fix would be to add some checks in:
lib/generators/active_record/templates/migration_existing.rb
and
Happy to sort a PR for this if we're all in agreement.
The text was updated successfully, but these errors were encountered: