mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
tests mostly pass
adjust to work with instance-based migations migrated_at can't be null why must people have last names? it's killing me!
This commit is contained in:
@@ -464,7 +464,7 @@ module ActiveRecord
|
||||
end
|
||||
|
||||
unless migrated.include?(version)
|
||||
execute "INSERT INTO #{sm_table} (version) VALUES ('#{version}')"
|
||||
execute "INSERT INTO #{sm_table} (version,migrated_at) VALUES ('#{version}','#{Time.now.to_s(:db)}')"
|
||||
end
|
||||
|
||||
inserted = Set.new
|
||||
@@ -472,7 +472,7 @@ module ActiveRecord
|
||||
if inserted.include?(v)
|
||||
raise "Duplicate migration #{v}. Please renumber your migrations to resolve the conflict."
|
||||
elsif v < version
|
||||
execute "INSERT INTO #{sm_table} (version) VALUES ('#{v}')"
|
||||
execute "INSERT INTO #{sm_table} (version,migrated_at) VALUES ('#{v}','#{Time.now.to_s(:db)}')"
|
||||
inserted << v
|
||||
end
|
||||
end
|
||||
|
||||
@@ -55,7 +55,7 @@ module ActiveRecord
|
||||
assume_migrated_upto_version(info[:version], schema.migrations_path) unless info[:version].blank?
|
||||
end
|
||||
|
||||
def self.migration(version, name="", options={})
|
||||
def migration(version, name="", options={})
|
||||
name, options = "", name if name.is_a?(Hash)
|
||||
|
||||
table = Arel::Table.new(ActiveRecord::Migrator.schema_migrations_table_name)
|
||||
|
||||
@@ -47,8 +47,9 @@ if ActiveRecord::Base.connection.supports_migrations?
|
||||
end
|
||||
|
||||
def test_migration_adds_row_to_migrations_table
|
||||
ActiveRecord::Schema.migration("123001")
|
||||
ActiveRecord::Schema.migration("123002", "add_magic_power_to_unicorns")
|
||||
schema = ActiveRecord::Schema.new
|
||||
schema.migration("123001")
|
||||
schema.migration("123002", "add_magic_power_to_unicorns")
|
||||
rows = @connection.select_all("SELECT * FROM #{@connection.quote_table_name(@sm_table)}")
|
||||
assert_equal 2, rows.length
|
||||
|
||||
|
||||
Reference in New Issue
Block a user