aboutsummaryrefslogblamecommitdiffstats
path: root/activerecord/lib/active_record/schema.rb
blob: 8527d5469780e082c992d8e5b5fd93c0d4983801 (plain) (tree)
1
2
3
                   

                          

















                                                            
   
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