Sha256: 927cfda4dd219cd7c686e5b2a4c6d21ea90b6593e0314fb5affcf2267c7e9b73
Contents?: true
Size: 915 Bytes
Versions: 54
Compression:
Stored size: 915 Bytes
Contents
# frozen_string_literal: true require_relative 'base' module DeclareSchema module SchemaChange class ColumnAdd < Base def initialize(table_name, column_name, column_type, **column_options) @table_name = table_name or raise ArgumentError, "must provide table_name" @column_name = column_name or raise ArgumentError, "must provide column_name" @column_type = column_type or raise ArgumentError, "must provide column_type" @column_options = column_options end def up_command "add_column #{[@table_name.to_sym.inspect, @column_name.to_sym.inspect, @column_type.to_sym.inspect, *self.class.format_options(@column_options)].join(", ")}" end def down_command "remove_column #{@table_name.to_sym.inspect}, #{@column_name.to_sym.inspect}" end end end end
Version data entries
54 entries across 54 versions & 1 rubygems