-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Labels
Description
Dialect
MySQL
Failing SQL
SELECT count(*) INTO @EXIST
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'mydatabase'
AND COLUMN_NAME = 'mycolumn'
AND TABLE_NAME = 'mytable' LIMIT 1;
SET @query = IF (@exist <= 0, 'ALTER TABLE mydatabase.`mytable` ADD COLUMN `mycolumn` MEDIUMTEXT NULL',
'select \' COLUMN EXISTS\' status');
PREPARE stmt FROM @query;
EXECUTE stmt;Description
I'm trying to write my migration files in a repeatable manner (So I don't have to create a new migration version EVERY time I need to make a change), but I can't seem to do this when altering a table when adding a column or adding an index. I don't necessarily need to do it in the above way, but I do think this should be supported some way.
Reactions are currently unavailable