class ActiveRecord::MigrationContext
def migrate(target_version = nil, &block)
If none of the conditions are met, +up+ will be run with
the +target_version+, then +down+ will be run.
If the +current_version+ in the schema is greater than
will be run.
0 then an empty array will be returned and no migrations
If the +current_version+ and +target_version+ are both
If +target_version+ is +nil+, +migrate+ will run +up+.
Runs the migrations in the +migrations_path+.
def migrate(target_version = nil, &block) case when target_version.nil? up(target_version, &block) when current_version == 0 && target_version == 0 [] when current_version > target_version down(target_version, &block) else up(target_version, &block) end end