Database considered not empty while deploying to a newly created empty DB
robertopesce
Posts: 4 New member
on some systems, while I deploy the package created with SCA I get this error: the database is seen as non empty and the baseline script is not deployed... this causes a later error while deploying the first migration because of objects missing.
1. how is SCA determining whether a DB is empty or not?
2. is it possible to force deployment of the baseline in case the __MigrationLog table is not present?
thank you
Roberto
New-DatabaseConnection, SQL Change Automation 4.2.20133.20020, Copyright © Red Gate Software Ltd 2014-2019
Import-DatabaseBuildArtifact, SQL Change Automation 4.2.20133.20020, Copyright © Red Gate Software Ltd 2014-2019
New-DatabaseReleaseArtifact, SQL Change Automation 4.2.20133.20020, Copyright © Red Gate Software Ltd 2014-2019
Creating SQL Change Automation release artifact
Building patch for the [SACDB] database on [localhost]...
Database not considered empty. 1 object differences found
SACDB: 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: 28.
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 C:\Users\fish6\AppData\Local\Temp\DLM Automation\ozdha30k.ogk\artifacts\SACDB_SACDB_Patch.sql
1 migration(s) in baseline, 27 migration(s) pending deployment
(Pre-Script) Pre-Deployment\01_Create_Database.sql
(Mark as Deployed) Migrations\1.0.0-Baseline\001_20200515-1100_fish6.sql
<div><br></div>I would like to know either:
1. how is SCA determining whether a DB is empty or not?
2. is it possible to force deployment of the baseline in case the __MigrationLog table is not present?
thank you
Roberto
Tagged:
Best Answer
-
Sergio R Posts: 610 Rose Gold 5Any user objects in a database will cause SQL Change Automation to consider it not empty.
If you want to override this behavior and still deploy the Baseline you have 2 options:
1- User a filter file that excludes the additional object or objects (in this case this would be the local user).
Please note that unlike with SQL Source Control projects you will not be able to apply this filter file only when deploying: you need to set this in the .sqlproj file
https://documentation.red-gate.com/sca/developing-databases/concepts/filtering
2 - Pre-create the dbo.__MigrationLog table (this is the table that keeps track of the migrations that have been applied) and leave it completely empty (you can copy the structure of this table from your development databaseSergio
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools
Answers