How can i remove a column from table using rails console

You can run the code in the up method directly in rails console:

>> ActiveRecord::Migration.remove_column :table_name, :column_name

If you already have a migration file such as “db/migrate/20130418125100_remove_foo.rb“, you can do this:

>> require "db/migrate/20130418125100_remove_foo.rb"
>> RemoveFoo.up

If you just want to do rake db:migrate, try this:

>> ActiveRecord::Migrator.migrate "db/migrate"

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)