qoyyim qoyyim - 4 months ago 11
Ruby Question

add column with default in lhm (Large Hadron Migrator)

I tried to add column with default value like

Lhm.change_table :recomendations do |m|
m.add_column :amount, "TINYINT", default: 1
end


but got error: wrong number of arguments (given 3, expected 2) gems/lhm-2.2.0/lib/lhm/migrator.rb:55:in `add_column'

what the correct code should be?

Answer

just realized it's just appending string to sql, just add default, not null etc like SQL

m.add_column :amount, "TINYINT DEFAULT 1"
Comments