Flyway Azure Pipeline Issue - Flyway CLI is creating a schema $(schemas) in deployment targets
Obiero
Posts: 4 New member
I'm using the Azure templated YAML for deployment pipelines in Azure DevOps, following the End-to-End Proof-of-Concept video. I noticed Flyway creates the flyway_schema_history table in ${(schemas)}. Shouldn't it be in dbo by default?
Additionally, my deployment fails with an "object already exists" error. It seems Flyway might be trying to apply all previous migrations, not just the new one. What could be causing this issue?
Here is output from the failed pipeline:
Caused by: Script B001_20240714150799__baseline.sql failed
-----------------------------------------------
SQL State : S0001
Error Code : 2714
Message : There is already an object named 'orders' in the database.
Tagged:
Answers
I've come across this behaviour myself, and it's down to the value you're putting for schemas in your vars yaml
I made an updated guide for creating a pipeline with SQL server with YAML which addresses these new changes - https://redgatesupport.zendesk.com/knowledge/editor/01HSZSGR4HQD2D8WTF8G973BD9/en-us?brand_id=3280206
Kind regards
Dan Calver | Redgate Software
Have you visited our Help Center?
Quick question: Is the databaseName in this variable group supposed to be the one for Production or for Checking? And isn't the target_database_JDBC supposed to be the full JDBC connection string and not just the database name?
Thank you for pointing out that error in one of my screenshots, I'll update that now!
databaseName should be the name of your production database!
Here's what it should look like:
Kind regards
Dan Calver | Redgate Software
Have you visited our Help Center?
I am still running into issues with the Drift and Change Report. Why does it try to execute the baseline script, yet it was already been applied? What could I be doing wrong yet I followed your guide step by step?
I think I am beginning to understand the problem. flyway clean command only deletes the flyway_schema_history table leaving other objects untouched hence the object already exists error...
That's odd, to isolate the issue, could you try creating a local flyway project with the database you're trying to clean as the target and then do a flyway clean command and see if you get an error?
Kind regards
Dan Calver | Redgate Software
Have you visited our Help Center?