gh-ost
gh-ost copied to clipboard
ENUM to Varchar
Getting a weird error via gh-ost. We are trying to alter a table from an ENUM to a Varchar
2022-10-13 04:47:38 FATAL Error 1048: Column 'payment_type' cannot be null; query=
update /* gh-ost `customcheckout`.`_purchase_gho` */
`customcheckout`.`_purchase_gho
This also happened when we were not changing this column. It's almost like gh-ost can't use the default data type on the new column.
ALTER TABLE purchase CHANGE COLUMN payment_type payment_type varchar(255) not null default 'CREDIT_CARD';
Any idea why gh-ost quietly fails? It seems like after a random time, it just fails.
:wave: @disser4 it sounds like the problem is that you are trying to change the field payment_type
to not null
, but payment_type
is null
for some rows. This is a data issue rather than a gh-ost issue - you'll either need to populate payment_type
in all rows with a value before running your schema migration, or remove the not null
constraint from the schema migration.