Wondering how SCA is determining if DB is empty or not. Because I clearly see there is some difference when I try to deploy a baselined project from VS on an empty db and via ADO CD agent on an empty Azure SQL DB. All our SCA projects were created from production schema as a baseline. This is the first time we are building an sca project which is supposed to do deploy in an empty project.When I run from VS on Azure DB, I get the log (truncated):
Database considered empty
5 migration(s) pending deployment
(Pre-Script) Pre-Deployment\01_Create_Database.sql (Deploy)
Same when run from ADO CD pipeline, logs from CD pipeline (truncated):
2020-03-02T17:53:52.2158737Z Database not considered empty. 11 object differences found
2020-03-02T17:53:52.2159990Z xxxxdb: A baseline build/deploy of the existing non-empty database will be required as the MigrationLog table doesn't exist and there are unapplied migrations. ProjectCount: 5.
2020-03-02T17:53:52.2162032Z Generating patch script C:\Users\VssAdministrator\AppData\Local\Temp\DLM Automation\iqn5ppqe.xuy\artifacts\xxxxxx_Patch.sql
2020-03-02T17:53:52.2191719Z ##[debug]Including the [dbo].[__MigrationLog] table script...
2020-03-02T17:53:52.2192962Z 1 migration(s) in baseline, 4 migration(s) pending deployment
2020-03-02T17:53:52.2193739Z (Pre-Script) Pre-Deployment\01_Create_Database.sql
2020-03-02T17:53:52.2194577Z (Mark as Deployed) Migrations\1.0.0-Baseline\001_20200220-0529_Baseline.sql
The same project when deployed from VS on an On-prem db: (This scenario is not important for me because the target db was set to Azure SQL and this is the wrong testing scenario. However, it is intresting to know why SCA is treating it as nont an epty db)
Database not considered empty. 1 object differences found
xxxdb: A baseline build/deploy of the existing non-empty database will be required as the MigrationLog table doesn't exist and there are unapplied migrations. ProjectCount: 5.
If you were expecting to run the baseline scripts against the database, see http://www.red-gate.com/sca/dev/baseline-troubleshoot
for information on how to set up appropriate filtering.
Generating patch script
\source\xxxzzxx\obj\Debug\xxxx_SCA.sql1 migration(s) in baseline, 4 migration(s) pending deployment
(Pre-Script) Pre-Deployment\01_Create_Database.sql (Mark as Deployed)