Rails - Accidentally lowered my table

Being stupid and careless, I accidentally fell off the table. How to re-create this table in RAils? I tried to run rake db:migrate , but did not create a new table. Thanks.

+4
source share
3 answers

You can perform certain migrations regardless of whether they were started.

 rake db:migrate:up VERSION=20101124121304 

This method is launched during the migration created on 11.24.2010 at 12:13:04. Locate the migration file containing the desired table and try the migration again. However, any data from this table cannot be restored.

+8
source

You cannot recover data, but I assume that you just need a structure?

Check if db/schema.rb . It should contain a definition of the current structure of your table.

You can recreate your entire database with db/schema.rb using rake db:setup . I do not know a method that recreates only one table.

But perhaps you can create a new database using a different name and copy the structure. Or tediously recreate the table yourself, based on what is in db/schema.rb .

+2
source

If you are a DROP MySQL table, you will not be able to restore this data if you did not make a backup.

0
source

All Articles