I am currently looking for a software/web development job preferably as a Rails-based developer.
Please email me at email@example.com. Thanks in advance for any leads!
How To Run Migrations And Migration Actions From The Rails Console
Posted by Weston Ganger
Sometimes you may need to fix your database by running the some migration commands in the console or in your code. Heres how to do so.
# To run single migration actions ActiveRecord::Migration.add_column(:table_name, :column_name, :integer) # To run all migrations ActiveRecord::Migrator.migrate('db/migrate') # To rollback 3 migrations ActiveRecord::Migrator.rollback('db/migrate', 3)
Related External Links: