Reputation: 29514
I have created a migration file for creating a table UserDetails in my db.. and it was working fine b4...
Unknowingly I deleted that table to do some modification .. But now when i gave
rake db:migrate .. its not creating the table ..
I have the migration file .. BUt when i give rake db:migrate its not creating.. How to do so ??
Upvotes: 0
Views: 1912
Reputation: 1551
Could you just run that specific migration as stated in the Guides. http://guides.rubyonrails.org/migrations.html#being-specific
I have run specific migrations by their timestamp before. It seems like it would work in this situation also.
Upvotes: 0
Reputation: 8807
Rails maintains a 'schema_migrations' table to know what migrations have already run and will not run the migrations that have already been completed. Since, you had already run the migration once, it would have updated the 'schema_migrations' table with the version no. of the migration. You can do rake db:rollback
to revert the last migration run or rake db:migrate:down VERSION=<version_number>
to revert any migration that was run before.
Now, I suggest if you know the version no (Time stamp of the file), you can manually delete from 'schema_migrations' table and re-run db:migrate
.
Upvotes: 1
Reputation: 25049
Rake stores the time of the most recent migration inside the database - if the migration you're trying to run is older than that, it won't run with rake db:migrate
.
I don't know how to run a specific migration manually, sorry :/
Upvotes: 0