我現在的遷移文件爲什麼直接更改遷移文件不會更改模式文件?
class CreateMovies < ActiveRecord::Migration
def up
create_table :movies, :force => true do |t|
t.string :title
t.string :rating
t.text :description
t.datetime :release_date
# Add fields that let Rails automatically keep track
# of when movies are added or modified:
t.timestamps
end
end
def down
drop_table :movies
end
end
我試圖改變RELEASE_DATE類型爲整數。所以我直接將文件更改爲
class CreateMovies < ActiveRecord::Migration
def up
create_table :movies, :force => true do |t|
t.string :title
t.string :rating
t.text :description
t.integer :release_date
# Add fields that let Rails automatically keep track
# of when movies are added or modified:
t.timestamps
end
end
def down
drop_table :movies
end
end
請注意,release_date類型已被更改。但經過我跑
束EXEC耙分貝:遷移
它仍然像以前一樣產生相同的架構文件。我感到很困惑。
正是我想要的答案! – new2cpp
假設它是最後一個'bundle exec rake db:migrate:redo'將回滾並重新遷移上次的遷移 –