2017-02-09 6 views
0

私はいくつかのマイグレーションファイルを持っていますが、何らかの理由でdb:migrateタスクが1つのマイグレーションファイルを無視するだけです。`rake db:migrate`を実行しているときにRailsが移行ファイルを無視するのはなぜですか?

class Assets < ActiveRecord::Migration 
 
    def change 
 
    create_table :assets do |t| 
 
     t.string :title 
 
     t.string :file 
 
     t.string :description 
 

 
     t.timestamps null: false 
 
    end 
 
    end 
 

 

 
end

私はすでにそれが作成し、テーブルを必要とする他の移行の前に実行されることを確認するには、この移行の順序を変更してみました。ここで

+1

「この移行の順序を変更する」とはどういう意味ですか? –

+1

"rake db:migrate:status"の出力は何ですか? –

答えて

0

はすくいコマンドのリストです:

rake db:create   # Create the database from DATABASE_URL or config/database.yml for the current Rails.env (use db:create:all to create all dbs in the config) 
rake db:drop   # Drops the database using DATABASE_URL or the current Rails.env (use db:drop:all to drop all databases) 
rake db:fixtures:load # Load fixtures into the current environment's database 
rake db:migrate   # Migrate the database (options: VERSION=x, VERBOSE=false) 
rake db:migrate:status # Display status of migrations 
rake db:rollback  # Rolls the schema back to the previous version (specify steps w/ STEP=n) 
rake db:schema:dump  # Create a db/schema.rb file that can be portably used against any DB supported by AR 
rake db:schema:load  # Load a schema.rb file into the database 
rake db:seed   # Load the seed data from db/seeds.rb 
rake db:setup   # Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the db first) 
rake db:structure:dump # Dump the database structure to db/structure.sql 
rake db:version   # Retrieves the current schema version number 

すべてmigrationsなどを削除して、もう一度、あなたのテーブルを作成しようとbundle exec rake db:drop:allを試してみてください。

関連する問題