Hi Team,
We are using agnostic to run all migration scripts (for mysql). As pert of this i have to drop a column if exists in table. for this i have added below script in migration file.
set @START_DATE_Check := (
select count(*) from information_schema.columns
where TABLE_NAME='COMMAND'
and COLUMN_NAME='START_DATE'
and TABLE_SCHEMA= 'ICPS'
) ;
set @sqlstmt := if(@START_DATE_Check > 0, 'alter table COMMAND drop column START_DATE', 'select "START_DATE does not exist in COMMAND" AS "Comment"') ;
prepare stmt from @sqlstmt ;
execute stmt ;
The above script working fine when i ran in mysql workbench, the column is removed if exists or else displayed the provided message.
Where as while running migration scripts by agnostic, there is no error and no impact on the table as well. (not removed the column).
Can you please help me here ?
Hi Team,
We are using agnostic to run all migration scripts (for mysql). As pert of this i have to drop a column if exists in table. for this i have added below script in migration file.
set @START_DATE_Check := (
select count(*) from information_schema.columns
where TABLE_NAME='COMMAND'
and COLUMN_NAME='START_DATE'
and TABLE_SCHEMA= 'ICPS'
) ;
set @sqlstmt := if(@START_DATE_Check > 0, 'alter table COMMAND drop column START_DATE', 'select "START_DATE does not exist in COMMAND" AS "Comment"') ;
prepare stmt from @sqlstmt ;
execute stmt ;
The above script working fine when i ran in mysql workbench, the column is removed if exists or else displayed the provided message.
Where as while running migration scripts by agnostic, there is no error and no impact on the table as well. (not removed the column).
Can you please help me here ?