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:
parent
0d9f1da955
commit
d8f99c36ba
1 changed files with 25 additions and 25 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue