1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Added Arel integration to migration's version update table

This commit is contained in:
Emilio Tagua 2009-04-23 13:55:42 -03:00
parent 0d9f1da955
commit d8f99c36ba

View file

@ -534,15 +534,15 @@ module ActiveRecord
private
def record_version_state_after_migrating(version)
sm_table = self.class.schema_migrations_table_name
table = Arel(self.class.schema_migrations_table_name)
@migrated_versions ||= []
if down?
@migrated_versions.delete(version.to_i)
Base.connection.update("DELETE FROM #{sm_table} WHERE version = '#{version}'")
table.where(table["version"].eq(version)).delete
else
@migrated_versions.push(version.to_i).sort!
Base.connection.insert("INSERT INTO #{sm_table} (version) VALUES ('#{version}')")
table.insert table["version"] => version
end
end