开发者

How to create a table in rails 3 when I manually deleted the tables in mysql?

I know its kinda embarrassing 'cause I made a very stupid mistake by manually deleting the tables in mysql instead of doing 'rake db:rollback'. I tried using 'rake db:migrate' to recreate those tables but nothing happened. I manually deleted the ta开发者_开发百科bles because I don't how to drop all the tables once and for all. Can somebody please tell me how to get this fixed and some advice how to prevent this. Does anybody know how to rollback all tables at once?


Run the following in the mysql client:

delete from schema_migrations where version = '<number at the beginning of the migration that created that table>'


You could run rake db:schema:load which will reload the table information from db/schema.rb, but it will wipe the data in all the tables.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜