diff options
Diffstat (limited to 'activerecord/lib/active_record/schema.rb')
-rw-r--r-- | activerecord/lib/active_record/schema.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/schema.rb b/activerecord/lib/active_record/schema.rb new file mode 100644 index 0000000000..1cb4aec3c8 --- /dev/null +++ b/activerecord/lib/active_record/schema.rb @@ -0,0 +1,23 @@ +module ActiveRecord + + class Schema < Migration #:nodoc: + 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 |