I'm using flyway Placeholders to conditionally execute statements against specific environments
We have a pipeline check before prod that looks at the schema history tables of QA/Test etc. to make sure that every script ran successfully against every previous environment - and fails the pipeline if it hasn't.
This is a requirement passed down by management.
So we unfortunately cannot use ShouldExecute because it will just not execute the whole script.
If we use ShouldExecute - that script will be missing from the schema history table in QA/Test if it is intended to only run against Prod.
So the script itself needs to have that conditional built into it so it can run successfully regardless of whether the statement inside executes.
I thought that maybe the below would work:
IF ${environment} = 'test' THEN
ALTER TABLE hr.job_history ADD (employee_name VARCHAR2(20 BYTE));
END IF;
which gives
SQL State : 42000
Error Code : 900
Message : ORA-00900: invalid SQL statement
Because the above statement only works inside of a function/procedure - is there an easy way to do this?
I looked at this thread but I don't know of way to adapt the script for my use case.