Being stupid, and careless, I accidentally dropped my table with contents. How do I re-create that table again in RAils? Tried to run rake db:migrate
but it didn't create a new table. Thanks.
For a dropped table to be recoverable, the table space in which the table resides must have the DROPPED TABLE RECOVERY option turned on. This option can be enabled during table space creation, or by invoking the ALTER TABLESPACE statement.
You can run specific migrations regardless of whether or not they have been run.
rake db:migrate:up VERSION=20101124121304
This runs the up method on the migration created on 11/24/2010 at 12:13:04 PM. Find the migration file that contains the table you need and rerun the migration. That being said, any data from that table is not recoverable.
You can't recover data, but I'm assuming you just want structure?
Check if you db/schema.rb
is up-to-date. It should contain a current structure definition of your table.
You can recreate your entire database from db/schema.rb
using rake db:setup
. I'm not aware of a method that recreates just a single 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's in db/schema.rb
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With