Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrations problems #9

Open
rdemorais opened this issue Apr 29, 2020 · 2 comments
Open

Migrations problems #9

rdemorais opened this issue Apr 29, 2020 · 2 comments

Comments

@rdemorais
Copy link

Dear,

In an attempt to run rake db:migrate I faced the following errors:

FILE: 20161226030601_add_lexicon_group_id_to_task.rb

class AddLexiconGroupIdToTask < ActiveRecord::Migration[5.0]
  def change
    **remove_reference :tasks, :lexicon, index: true, foreign_key: true**
    add_reference :tasks, :lexicon_group, index: true, foreign_key: true
  end
end

And
FILE: 20161224055432_create_lexicon_groups.rb

class CreateLexiconGroups < ActiveRecord::Migration[5.0]
  def change
    **remove_reference :lexicons, :collection, index: true, foreign_key: true**
    
    **remove_column :collections, :mode_url**

    add_reference :tasks, :lexicon, index: true, foreign_key: true

    remove_column :tasks, :model_url
    remove_column :tasks, :xml_url

    create_table :lexicon_groups do |t|
      t.string :name
      t.references :user, foreign_key: true

      t.timestamps
    end
    add_reference :lexicons, :lexicon_group, index: true, foreign_key: true    
  end
end

The marked lines raise errors as the relations don't exist. I've removed the lines and everything goes well.

Can you confirm that by removing them the problem goes away or is another solution expected?

Thanks.

@dongseop
Copy link
Collaborator

I tested all from scratch on my computer and all migrations worked well.

I guess that your database is not consistent with the migration result.
Maybe the database is changed without migration or you missed some migration.
If you do not have important data in the database, just drop it and migrate from the beginning.
So please drop the database and create it again. Then run the migration again.

rake db:drop
rake db:create
rake db:migrate

@rdemorais
Copy link
Author

@dongseop thanks for the reply.

Just for the record, what I did was to clone this repo and execute rake db:create and then rake db:migrate and the error comes in.

Nevertheless, I've removed the items, and installation has succeeded. I've also included a Dockerfile with Mysql embedded to keep it simple, and we are already using the tool in our projects. Thanks for that.

You can close this issue if you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants