mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
b3df95985a
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2339 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
22 lines
487 B
Ruby
22 lines
487 B
Ruby
module ActiveRecord
|
|
# TODO: Document me!
|
|
class Schema < Migration
|
|
private_class_method :new
|
|
|
|
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 = quote(v, cols.detect { |c| c.name == k.to_s })
|
|
"#{k} = #{v}"
|
|
end
|
|
|
|
update "UPDATE schema_info SET #{info.join(", ")}"
|
|
end
|
|
end
|
|
end
|
|
end
|