When I tried to roll back the migration file with rails db: rollback, I was suffering from the error UnknownMigrationVersionError as below, so I will write about this solution.
rails aborted! ActiveRecord::UnknownMigrationVersionError: No migration with version number 20201230115014.
When I checked the status of the migration file with rails db: migrate, there was some unfamiliar data written as NO FILE. This was because the migration file was deleted on the VS code with the status up, so the data remained on the DB. (Probably the file I created by forgetting skip-migration when I created the model with ActiveHash \ ...) In summary, the cause of the UnknownMigrationVersionError was that the migration data, which did not have a corresponding file, remained.
First, create a file on the VS code that corresponds to the data whose ID is 20201230115014, which was NO FILE. (This time, it is created with the file name "20201230115014.dummy.rb".)
If you try to roll back with just the migration file created, the following error will occur. This is because the contents of the migration file created earlier are not described.
rails aborted! NameError: uninitialized constant Dummy
To solve this, write the class and change action in the migration file. After that, perform migration once.
class Dummy < ActiveRecord::Migration[6.0] def change end end
In this state, if you roll back, the status will be down safely.
At this point, all you have to do is delete the target file. After deleting the file "20201230115014.dummy.rb" with VS code, if you check with rails db: migrate: status, you can confirm that the target data can be deleted safely.
I casually thought that deleting the migration file without checking the status would be troublesome later. I hope it will be a hint for those who see something.