ruby on rails - Rake db:migrate not ignoring old migrations? -
running through michael hartl's known rails tutorial, hit snag.
i have in migration file, created rails generate model
etc:
class createusers < activerecord::migration def change create_table :users |t| t.string :name t.string :email t.timestamps end end end
later, added second migration file:
class addindextousersemail < activerecord::migration def change add_index :users, :email, unique: true end end
to try , update database include new one, followed instructions , ran rake db:migrate
, gives me error telling me i'm trying create table exists, i'm missing something.
am i...supposed delete first migration? wouldn't make sense. do?
(these files under db/migrate
)
if realy want see migrations have been ran database, can inspect app database, there table called schema_migrations, in there can see unique id of each migration row example migration called: 20130402190449_add_flagand_table.rb, should see number 20130402190449 row of table, hope gave guidance
Comments
Post a Comment