Baseline for existing database
bitman
Posts: 8 New member
Hello,
I have an existing database that I want to use for SCA as my baseline. I followed the video tutorials but I do not want to create a baseline migration that will be run on my existing database that has schema and data already. I just want to track changes and produce migrations moving forward. Can you suggest how I can accomplish this or am I doing it wrong?
Thank you!
I have an existing database that I want to use for SCA as my baseline. I followed the video tutorials but I do not want to create a baseline migration that will be run on my existing database that has schema and data already. I just want to track changes and produce migrations moving forward. Can you suggest how I can accomplish this or am I doing it wrong?
Thank you!
Tagged:
Answers
The SQL Change Automation Baseline is actually only used for the SHADOW Database and the CI Build when you choose to generate a baseline script from a later stage environment. When deploying to e.g. Staging for the first time, SQL Change Automation will assume the baseline already exists there, and so it will create the SCA related tables (_MigrationLog and _SchemaSnapshot), then it will mark the baseline as "already deployed", and then run any incremental migrations you have generated since then.
I hope this helps? Let me know if you have any further questions!
I saw a video regarding this matter after I posted my question.
https://www.red-gate.com/hub/university/courses/sql-change-automation/working-with-sql-change-automation-and-source-control/working-with-sql-change-automation-and-source-control/existing-databases
I am trying to follow it and hopefully is the answer to my query. Thank you.
Normally when the baseline script is failing this is because SCA cannot create the shadow using it, because there are invalid objects/references or references to objects that don't exist where you're creating the shadow DB.
E.g. there's a view in the DB referencing another DB that is present on the Staging server, but not the development server where your shadow is being created
Is this the case for you? Thanks!