method
migrate
v6.0.0 -
Show latest stable
- Class:
ActiveRecord::Migration
migrate(direction)public
Execute this migration in the named direction
# File activerecord/lib/active_record/migration.rb, line 801
def migrate(direction)
return unless respond_to?(direction)
case direction
when :up then announce "migrating"
when :down then announce "reverting"
end
time = nil
ActiveRecord::Base.connection_pool.with_connection do |conn|
time = Benchmark.measure do
exec_migration(conn, direction)
end
end
case direction
when :up then announce "migrated (%.4fs)" % time.real; write
when :down then announce "reverted (%.4fs)" % time.real; write
end
end Related methods
- Instance methods
- announce
- connection
- copy
- disable_ddl_transaction
- down
- exec_migration
- method_missing
- migrate
- next_migration_number
- proper_table_name
- reversible
- revert
- reverting?
- run
- say
- say_with_time
- suppress_messages
- table_name_options
- up
- up_only
- write
- Class methods
- []
- check_pending!
- current_version
- disable_ddl_transaction!
- inherited
- load_schema_if_pending!
- maintain_test_schema!
- method_missing
- migrate
- nearest_delegate
- new
- Private methods
-
command_recorder -
execute_block