[RUBY] [rails] heroku deployment error ActionView :: Template :: Error (Mysql2 :: Error: Table --- doesn't exist):

I got an error when deploying to heroku. We are sorry ...

error contents

When I checked the logs with heroku logs --tail --app [app name], I got an error like m below. This seems to be an error in a table

ActionView::Template::Error (Mysql2::Error: Table 'heroku----' doesn't exist):

Possible causes

Upon examination, the following three possible causes for this error statement were (there may be others):

1rails version issue

In the case of rails 5.0 and 5.2, it seems that such an error may occur. There seems to be a problem in terms of how to write the migration file and the type. I haven't examined it in detail in 6.0, so please check if it applies to you.

2 There is an or NO FILE that is not up when checked.

Check rails db: migrate: status in your terminal If there is a no file, you have to delete it (I'll show you how to do it in another article)

3 Not properly migrated in SQL on heroku

heroku run rails db:migrate

This fixed it.

Or rather, if you read the error statement carefully, it may be that this is the only cause. ...

That was all

Recommended Posts

[rails] heroku deployment error ActionView :: Template :: Error (Mysql2 :: Error: Table --- doesn't exist):
[Deployment error] Mysql2 :: Error: Table'~' already exists: CREATE TABLE `~`
Error deploying rails5 + Mysql to heroku with Docker-compose
rails heroku error log
[Rails] Heroku deployment flow
Rails (postgeresql. Ubuntu environment), heroku deployment
[Rails] AWS deployment error encounter summary
Deploy heroku with Rails6 (Cloud9 + Ubuntu) + MySQL
Deploy to heroku with Docker (Rails 6, MySQL)
[rails s error] md5.bundle and mysql installation error
[heroku] run rails db: migrate doesn't work
[Rails / Heroku] Error resolution procedure after push
[Solution] Webpacker error when introducing Vuetify to Rails6 "ActionView :: Template :: Error Webpacker can't find hello_vue ~"