mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
schema migrations work as instances
This commit is contained in:
parent
8b2f801ed8
commit
0bea9fd6be
3 changed files with 11 additions and 6 deletions
|
@ -288,12 +288,15 @@ module ActiveRecord
|
|||
#
|
||||
class Migration
|
||||
class << self
|
||||
attr_accessor :verbose
|
||||
attr_accessor :delegate # :nodoc:
|
||||
def method_missing(name, *args, &block) # :nodoc:
|
||||
end
|
||||
|
||||
def self.method_missing(name, *args, &block) # :nodoc:
|
||||
(delegate || superclass.delegate).send(name, *args, &block)
|
||||
end
|
||||
end
|
||||
|
||||
cattr_accessor :verbose
|
||||
|
||||
self.delegate = new
|
||||
self.verbose = true
|
||||
|
||||
|
|
|
@ -46,11 +46,12 @@ module ActiveRecord
|
|||
# ...
|
||||
# end
|
||||
def self.define(info={}, &block)
|
||||
new.instance_eval(&block)
|
||||
schema = new
|
||||
schema.instance_eval(&block)
|
||||
|
||||
unless info[:version].blank?
|
||||
initialize_schema_migrations_table
|
||||
assume_migrated_upto_version(info[:version], migrations_path)
|
||||
assume_migrated_upto_version(info[:version], schema.migrations_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,6 +19,7 @@ if ActiveRecord::Base.connection.supports_migrations?
|
|||
class <<self
|
||||
attr_accessor :message_count
|
||||
end
|
||||
|
||||
def puts(text="")
|
||||
self.class.message_count ||= 0
|
||||
self.class.message_count += 1
|
||||
|
|
Loading…
Reference in a new issue