SUPPORT THE SITE WITH A CLICK

Subscribe Rss:

SUPPORT THE SITE WITH A CLICK

Thursday, March 20, 2008

remove a column using rake in rails migrations

First create a migration file.Then edit the file like this,

class RemMenuposition < ActiveRecord::Migration
def self.up
remove_column :menus,:lposition
end

def self.down
end
end

Here i am removing a column lposition from the table menu.If u are going to run the migration first time then type rake db:migrate,then type rake db:rollback in the terminal and finally give rake db:migrate.
Now the column lposition have been removed sucessfully

No comments :

Post a Comment