mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
schema migrations work as instances
This commit is contained in:
@@ -288,12 +288,15 @@ module ActiveRecord
|
||||
#
|
||||
class Migration
|
||||
class << self
|
||||
attr_accessor :verbose
|
||||
attr_accessor :delegate # :nodoc:
|
||||
def method_missing(name, *args, &block) # :nodoc:
|
||||
(delegate || superclass.delegate).send(name, *args, &block)
|
||||
end
|
||||
end
|
||||
|
||||
def self.method_missing(name, *args, &block) # :nodoc:
|
||||
(delegate || superclass.delegate).send(name, *args, &block)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user