aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/schema.rb
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2008-04-09 16:20:15 +0000
committerRick Olson <technoweenie@gmail.com>2008-04-09 16:20:15 +0000
commit8a5a9dcbf64843f064b6e8a0b9c6eea8f0b8536e (patch)
tree27064d2d5ebccdd40bf5c4f43fcf5b2e3e7e57f3 /activerecord/lib/active_record/schema.rb
parent78c2d9fc223e7a9945aee65c838f7ce78e9ddb3e (diff)
downloadrails-8a5a9dcbf64843f064b6e8a0b9c6eea8f0b8536e.tar.gz
rails-8a5a9dcbf64843f064b6e8a0b9c6eea8f0b8536e.tar.bz2
rails-8a5a9dcbf64843f064b6e8a0b9c6eea8f0b8536e.zip
Add support for interleaving migrations by storing which migrations have run in the new schema_migrations table. Closes #11493 [jordi]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9244 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/schema.rb')
-rw-r--r--activerecord/lib/active_record/schema.rb17
1 files changed, 5 insertions, 12 deletions
diff --git a/activerecord/lib/active_record/schema.rb b/activerecord/lib/active_record/schema.rb
index 9d50efb74f..d6b254fcf9 100644
--- a/activerecord/lib/active_record/schema.rb
+++ b/activerecord/lib/active_record/schema.rb
@@ -34,24 +34,17 @@ module ActiveRecord
# #add_index, etc.).
#
# The +info+ hash is optional, and if given is used to define metadata
- # about the current schema (like the schema's version):
+ # about the current schema (currently, only the schema's version):
#
- # ActiveRecord::Schema.define(:version => 15) do
+ # ActiveRecord::Schema.define(:version => 20380119000001) do
# ...
# end
def self.define(info={}, &block)
instance_eval(&block)
- unless info.empty?
- initialize_schema_information
- cols = columns('schema_info')
-
- info = info.map do |k,v|
- v = Base.connection.quote(v, cols.detect { |c| c.name == k.to_s })
- "#{k} = #{v}"
- end
-
- Base.connection.update "UPDATE #{Migrator.schema_info_table_name} SET #{info.join(", ")}"
+ unless info[:version].blank?
+ initialize_schema_migrations_table
+ assume_migrated_upto_version info[:version]
end
end
end