exception_handler icon indicating copy to clipboard operation
exception_handler copied to clipboard

Migration tries to recreate table if it already exists

Open davidhajje opened this issue 8 years ago • 1 comments

As per the documentation, for ActiveRecord integration, all that is required is to run rails db:migrate This also adds the errors table in to the schema.rb file.

The problem is then whenever anyone calls rails db:reset it gets the database configuration from the schema.rb and creates the errors table.

When db:migrate is used again (such as to complete a later migration), it tries to create the errors table again throwing a duplicate table error.

Steps to reproduce

  1. run rails db:migrate to create the errors table and update schema.rb
  2. run rails db:reset to reset the database as per the schema file
  3. run rails db:migrate again to get the exception handler gem to try and recreate the table again

Expected behaviour

Exception handler should know that a table with the same name (and/or same columns) already exists and not try to recreate the table

Actual behaviour

Exception handler tries to recreate the errors table

System Configuration

Ruby 2.2.4 Rails 5.0.1 PostgreSQL 9.5.4

davidhajje avatar May 11 '17 03:05 davidhajje

Thanks for the comment, will investigate

richpeck avatar May 11 '17 10:05 richpeck