Home>

This is the first post.

Premise

Currently, I am creating a question app on rails.
I decided to implement a feature that allows me to bookmark questions.

First I wanted to create a model and created a "like" model, but I didn't like the table name "likes" so I tried to delete it. However, because I was ignorant, I thought that if I deleted the model as it was, the table would also be deleted, but only the model disappeared and only the table remained.

So, referring to the following article, I created a migration file called 20201105xxxxxx_drop_likes.rb to delete the remaining likes table, and I succeeded in deleting the table.

https://qiita.com/miyahkun/items/1215e54c86e80e4b5324

After that, I recreated the bookmark function, ran the test in the local environment, confirmed it, and deployed it.
When deploying, the following message occurred.

StandardError: An error has occurred, all later migrations canceled:
Mysql2 :: Error: Unknown table'likes'
Corresponding source code (20201105xxxxxx_drop_likes.rb)
class DropLikes
What I tried

After doing heroku run rails db: reset
I ran heroku run rails db: migrate again,
I got similar results.

Supplementary information

MacOS Catalina
ruby 2.6.5p114
Rails 6.0.3.4
heroku 7.47.0

We apologize for the inconvenience, but thanks for your response.
Please point out any incomplete information.

  • Answer # 1

    It wasn't the ultimate solution, but it was avoided.

    For this error avoidance method, I decided to continue implementing it by giving a completely different application name to a completely different database using the code until just before the error appeared on GitHub.

    Thank you very much.