How can we help you today? How can we help you today?

Baseline for existing database

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!
bitman
0

Comments

4 comments

  • PlantBasedSQL
    Hi @bitman thank you for your question! I hope you're well?

    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!
    PlantBasedSQL
    0
  • bitman
    Thank you @PlantBasedSQL for your reply.  Thanks for the well wishes.  I hope you are safe and healthy as well.

    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.
    bitman
    0
  • Yuping
    I follow exactly what tutorial said but each time I try to refresh, the SCA complained the script verification failed and it point into the baseline script. It is very confused.
    Yuping
    0
  • PlantBasedSQL
    Hi @Yuping are you able to share what errors you're getting please?

    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!
    PlantBasedSQL
    0

Add comment

Please sign in to leave a comment.