diff options
author | Josh Susser <josh@hasmanythrough.com> | 2012-12-01 18:32:23 -0800 |
---|---|---|
committer | Josh Susser <josh@hasmanythrough.com> | 2012-12-01 19:41:09 -0800 |
commit | 0a5afa229d769bce9e221f34053bb93b60817a5a (patch) | |
tree | dfc0149cf2dd6b9545f01ef50d3758d68ced15d4 /activerecord/lib/active_record/connection_adapters/abstract | |
parent | a7776924a67d32067b2c1ecb9ca773c96a33da63 (diff) | |
download | rails-0a5afa229d769bce9e221f34053bb93b60817a5a.tar.gz rails-0a5afa229d769bce9e221f34053bb93b60817a5a.tar.bz2 rails-0a5afa229d769bce9e221f34053bb93b60817a5a.zip |
Add metadata to schema_migrations
migrated_at: timestamp when migration run
fingerprint: md5 hash of migration source
name: filename without version or extension
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index f1e42dfbbe..7802cb02d8 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -490,7 +490,7 @@ module ActiveRecord sm_table = ActiveRecord::Migrator.schema_migrations_table_name ActiveRecord::SchemaMigration.order('version').map { |sm| - "INSERT INTO #{sm_table} (version) VALUES ('#{sm.version}');" + "INSERT INTO #{sm_table} (version, migrated_at, name) VALUES ('#{sm.version}',LOCALTIMESTAMP,'#{sm.name}');" }.join "\n\n" end @@ -512,7 +512,7 @@ module ActiveRecord end unless migrated.include?(version) - execute "INSERT INTO #{sm_table} (version) VALUES ('#{version}')" + ActiveRecord::SchemaMigration.create!(:version => version, :migrated_at => Time.now) end inserted = Set.new @@ -520,7 +520,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}')" + ActiveRecord::SchemaMigration.create!(:version => v, :migrated_at => Time.now) inserted << v end end |