简体   繁体   中英

Migrations are pending. To resolve this issue, run: bin/rake db:migrate RAILS_ENV=development

This is the error I am getting when I try to view my page that I am creating with ruby on rails. The problem is, I have already migrated my database from mysql to my ruby application. I can see it in the schema.rb folder

ActiveRecord::Schema.define(version: 0) do

  create_table "users", force: true do |t|
    t.string "first_name", null: false 
    t.string "last_name",  null: false
    t.string "username",   null: false
    t.string "password",   null: false
    t.string "email",      null: false
  end

end

here is my migration file inside my migrate folder

class CreateUsers < ActiveRecord::Migration
  def change
    create_table :users do |t|
      t.timestamps
    end
  end
end

All I am trying to do is run a scaffold for that database and I keep getting the error.

ok, I think I have figured it out. I ran rake db:migrate --trace because of a comment above and got a huge error that started off with:

rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
rake aborted!
ActiveRecord::NoDatabaseError: Unknown database 'recipe_library_development'Run `$ bin/rake db:create db:migrate` to create your database

So, based on that I ran: bin/rake db:create db:migrate

I reloaded my page and the error went away.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM