Rake db:放弃我的旧桌子
我的用户迁移过去看起来像这样:
class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| t.string :login etc
现在它看起来像这样:
class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| t.string :username etc
那么,为什么我会看到这个?
rake db:drop rake db:create rake db:migrate rails console > User.new +----+-------+------------------+---------------+-------------------+------------+------------+ | id | login | crypted_password | password_salt | persistence_token | created_at | updated_at | +----+-------+------------------+---------------+-------------------+------------+------------+ | | | | | | | | +----+-------+------------------+---------------+-------------------+------------+------------+ 1 row in set
我正在使用PostgreSQL。
增加用户迁移的文件名解决了这个问题。 当我试图在不改变文件名的情况下改变其内容时,我认为Rails正在缓存迁移的内容。