Sha256: ef1371e9fc7e73178f45b0913ae754933abc44bf5c9cc164fcebd2009d6911c3

Contents?: true

Size: 493 Bytes

Versions: 1

Compression:

Stored size: 493 Bytes

Contents

module DataMigrations
  class Instruction
    class Set < Base
      attr_reader :column, :value

      def initialize(migration, column, value)
        super(migration)
        @column = Column.new(migration.target, column)
        @value  = value
      end

      def statements
        [update_statement]
      end

      protected

        def update_statement
          "UPDATE #{target.quoted_name} SET #{column.quoted_name} = #{column.quote_value(value)}"
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
data_migrations-0.0.1 lib/data_migrations/instruction/set.rb