method
migrate
rails latest stable - Class:
ActiveRecord::InvalidMigrationTimestampError::Migration
Method not available on this version
This method is only available on newer versions. The first available version (v7.2.3) is shown here.
migrate(direction)public
Execute this migration in the named direction
# File activerecord/lib/active_record/migration.rb, line 967
def migrate(direction)
return unless respond_to?(direction)
case direction
when :up then announce "migrating"
when :down then announce "reverting"
end
time = nil
ActiveRecord::Tasks::DatabaseTasks.migration_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
- connection_pool
- copy
- disable_ddl_transaction
- down
- exec_migration
- execution_strategy
- 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_all_pending!
- check_pending_migrations
- current_version
- disable_ddl_transaction!
- inherited
- load_schema_if_pending!
- maintain_test_schema!
- method_missing
- migrate
- nearest_delegate
- new
- valid_version_format?
- verbose
- Private methods
-
any_schema_needs_update? -
db_configs_in_current_env -
env -
pending_migrations -
command_recorder -
execute_block -
format_arguments -
internal_option?