Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No change in db after the migration script ran #20

Open
phani50 opened this issue Jul 27, 2021 · 0 comments
Open

No change in db after the migration script ran #20

phani50 opened this issue Jul 27, 2021 · 0 comments

Comments

@phani50
Copy link

phani50 commented Jul 27, 2021

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant