diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2012-12-09 15:52:28 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2012-12-09 15:57:34 -0700 |
commit | cff747d304f008c103a7ba92440400a9a0848bee (patch) | |
tree | 88e4ac162d9a90db715abecbbfbfe155c7756d6f /activerecord/lib/active_record/schema.rb | |
parent | 3c2c1a46064684a1becc8ae7b6b7fe6eebf9651a (diff) | |
download | rails-cff747d304f008c103a7ba92440400a9a0848bee.tar.gz rails-cff747d304f008c103a7ba92440400a9a0848bee.tar.bz2 rails-cff747d304f008c103a7ba92440400a9a0848bee.zip |
Move to the schema-migrations-metadata branch.
Pending work on graceful app upgrades.
Revert "Merge pull request #8439 from joshsusser/fixes"
This reverts commit ce8ac39338f86388e70356b3a470b3ea443802ae, reversing
changes made to b0e7b6f67c984d4b1502e801781ed75fad681633.
Revert "Merge pull request #8431 from joshsusser/schemadump"
This reverts commit 036d3e1c2b65c4b8cbd23de2e20ad67b9b756182, reversing
changes made to 0c692f4d121792117b6a71e5ed590a31c3b9d12e.
Revert "Merge branch 'joshsusser-master' into merge"
This reverts commit 0c692f4d121792117b6a71e5ed590a31c3b9d12e, reversing
changes made to 2e299fca715b083a60222a85e48f9d3b8dd8ce93.
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
activerecord/test/cases/schema_dumper_test.rb
Diffstat (limited to 'activerecord/lib/active_record/schema.rb')
-rw-r--r-- | activerecord/lib/active_record/schema.rb | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/activerecord/lib/active_record/schema.rb b/activerecord/lib/active_record/schema.rb index 44b7eb424b..3259dbbd80 100644 --- a/activerecord/lib/active_record/schema.rb +++ b/activerecord/lib/active_record/schema.rb @@ -39,45 +39,27 @@ module ActiveRecord end def define(info, &block) # :nodoc: - @using_deprecated_version_setting = info[:version].present? - SchemaMigration.drop_table - initialize_schema_migrations_table - instance_eval(&block) - # handle files from pre-4.0 that used :version option instead of dumping migration table - assume_migrated_upto_version(info[:version], migrations_paths) if @using_deprecated_version_setting + unless info[:version].blank? + initialize_schema_migrations_table + assume_migrated_upto_version(info[:version], migrations_paths) + end end # Eval the given block. All methods available to the current connection # adapter are available within the block, so you can easily use the # database definition DSL to build up your schema (+create_table+, # +add_index+, etc.). - def self.define(info={}, &block) - new.define(info, &block) - end - - # Create schema migration history. Include migration statements in a block to this method. - # - # migrations do - # migration 20121128235959, "44f1397e3b92442ca7488a029068a5ad", "add_horn_color_to_unicorns" - # migration 20121129235959, "4a1eb3965d94406b00002b370854eae8", "add_magic_power_to_unicorns" - # end - def migrations - raise(ArgumentError, "Can't set migrations while using :version option") if @using_deprecated_version_setting - yield - end - - # Add a migration to the ActiveRecord::SchemaMigration table. # - # The +version+ argument is an integer. - # The +fingerprint+ and +name+ arguments are required but may be empty strings. - # The migration's +migrated_at+ attribute is set to the current time, - # instead of being set explicitly as an argument to the method. + # The +info+ hash is optional, and if given is used to define metadata + # about the current schema (currently, only the schema's version): # - # migration 20121129235959, "4a1eb3965d94406b00002b370854eae8", "add_magic_power_to_unicorns" - def migration(version, fingerprint, name) - SchemaMigration.create!(version: version, migrated_at: Time.now, fingerprint: fingerprint, name: name) + # ActiveRecord::Schema.define(version: 20380119000001) do + # ... + # end + def self.define(info={}, &block) + new.define(info, &block) end end end |