fineboy1
fineboy1

Reputation: 21

Ruby on rails migration not working

I initially ran a migration when I created the database and everything worked fine. Then I went and deleted the table in postgresql manually. Now when I run rake db:migrate, it runs but doesn't create the table.

Upvotes: 0

Views: 395

Answers (1)

0x4a6f4672
0x4a6f4672

Reputation: 28245

It depends on what your migrations do. rake db:migrate can create or change tables, depending on your definitions. To setup the database and the tables in the beginning you can use rake db:schema:load or rake db:setup. rake -T gives an overview over all available rake tasks.

Database migrations are stored in the table schema_migrations which has one column version. As long as the version of the migration in question can be found here, the migration is not executed again.

Upvotes: 1

Related Questions