I have a Rails 5 app and I wanted to destroy and rebuild my live database (site not launched yet). So I followed the steps that should've worked (they used to work in the past):
- heroku pg:reset HEROKU_POSTGRESQL_HEROKUCOLOR_URL --confirm {app_name}
- heroku run rake db:migrate
- heroku run rake db:seed
Steps 1 & 2 complete successfully and step 3 fails with the error ('adminsettings' is one of my tables):
Running rake db:seed on {app_name}... starting, run.7198 (Hobby)
Running rake db:seed on {app_name}... connecting, run.7198 (Hobby)
Running rake db:seed on {app_name}... up, run.7198 (Hobby)
rake aborted!
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "adminsettings" does not exist
LINE 8: WHERE a.attrelid = '"adminsettings"'::regclas...
If I run heroku pg:info it returns I have 2 tables (I should have about 10) so it is as if the step 2 failed (even though there was no error). If I check pgAdmin4 I can only see 2 tables: ar_internal_metadata and schema_migrations which are not my custom tables.
I deleted all migrations after ensuring they are in my schema.rb file so there are actually no migrations necessary - just the table creations. So my first question is: Does (should!) the 'heroku rake db:migrate' just use the schema.rb file to build the tables?
This is a Rails 5.2.2 app but it started off as Rails 4.x app and I upgraded all gems along the way. Would this be a cause somehow? There was no issue up to now except when I tried this destructive rebuild. Otherwise, I'm out of ideas. And I don't have much debug visibility into what is going wrong.