views:

41

answers:

2

I created 2 models and ran the migrations, attempted some work on each of them and now I would like to start over and approach them differently. I'm new to Rails and have never attempted to delete/remove database tables (apart from rolling them back right after I migrated them).

Thanks!

+1  A: 

Create another migration and in self.up

drop_table :tablename

http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-drop_table

David Lyod
Thanks. I don't know why this didn't come up in my searches.
teecraft
A: 

If you never committed the changes or deployed the app, you can simply remove the model files and remove the tables from your database using the database console (assuming it's sqlite3 type sqlite3 to enter the shell console) or a database administration GUI.

Otherwise, you will need to use the drop_table migration to reflect the changes on the production system.

Simone Carletti
Thanks. I was wondering if I could use SQLite DB Browser to just delete the tables. Can I just delete old migration files as well?
teecraft