Boris Kuzevanov
Boris Kuzevanov

Reputation: 1302

Rails superclass mismatch for class on migrations

I am junior Ruby on Rails dev.

I have this problem: I've updated my rails from 5.1 to 6. If I try to run

rails db:migrate 

there are errors:

TypeError: superclass mismatch for class CreateVacancyFields

Looking inside my migration file:

class CreateVacancyFields < ActiveRecord::Migration[ 5.1 ]

Ok, I've changed 5.1 to 6.0 like this:

class CreateVacancyFields < ActiveRecord::Migration[ 6.0 ]

But it doesn't help. What I do wrong?

Upvotes: 4

Views: 2565

Answers (2)

timjini
timjini

Reputation: 147

If someone else is looking into this, you must probably have made a previous migration with the same name, if you haven't used it will look empty

`class NameOfModel < ActiveRecord::Migration[6.1]
end`

just delete the file from db folder, just make sure it is not active then rails db:migrate

Upvotes: 0

Masafumi Okura
Masafumi Okura

Reputation: 724

Possibly you're having the same named class CreateVacancyFields twice. If so, rename it to some different name to resolve this issue.

Upvotes: 5

Related Questions