Considering that you have not setup your database for your app. At that time, you can easily setup your database using given commands:
bundle exec rake db:create bundle exec rake db:migrate
OR simply you can hit
bundle exec rake db:setup
If you need to run a specific migration file. Then use these commands Using VERSION
bundle exec rake db:migrate VERSION='timestamp of given migration file'
Redo that VERSION
bundle exec rake db:migrate:redo VERSION='timestamp of given migration file'
Redo that VERSION specifying step
rake db:migrate:redo STEP=3
Using Rails Console
bundle exec rails c require "#{Rails.root}/db/migrate/your_migration_file_name.rb" YourMigrationFile.new.change OR ActiveRecord::Migration.{{migration_type}} :table_name, :column_name Example: ActiveRecord::Migration.remove_column :table_name, :column_name
Some extra commands you may need
YourMigrationFile.new.change.migrate YourMigrationFile.new.change.migrate(:up)
Hope you can tackle any type of active-record migration and issues while doing migrations. 🙂