If I use rake db:rollback it will delete a table I don't want. Then I add another migration with a new table. Then I run db:migrate. The table I didn't want is created again. How do I delete it so it doesn't come back?
Example :
class CreateNewTable< ActiveRecord::Migration def self.up create_table :new_tables do |t| t.column :name, :string end
drop_table :old_tables
#rename_table :old_tables, :new_tables rename_table :books, :libraries
#remove_column(table_name, column_name) remove_column :items, :price
#remove_column(table_name, column_name) rename_column "users", "password", "hashed_password"
#add_column table_names, new_column_names add_column "users", "email"
end
def self.down drop_table :lupa_passwords end end
Visit Indonesia 2008 wrote:
Example :
class CreateNewTable< ActiveRecord::Migration def self.up create_table :new_tables do |t| t.column :name, :string end
drop_table :old_tables
Thanks. Now I got it.
Pål Bergström wrote:
class CreateNewTable< ActiveRecord::Migration def self.up create_table :new_tables do |t| t.column :name, :string end
drop_table :old_tables
Thanks. Now I got it.
Your customers won't mind copying all the data from the old table to the new one. (-: