SQL Release will always drop tables if they aren't being source controlled. But you do have some ways to stop it.
The simplest way is to add a filter that ignores the tables that are being dropped (https://documentation.red-gate.com/disp ... QL+Release), this works if the tables that are being dropped are always the same ones.
Alternatively you can check all tables into Source Control.
You can add a manual review step or interrogate the warnings with powershell and stop if there is a table drop:
$ErrorActionPreference = "Stop"
$db = New-DlmDatabaseConnection -ServerInstance .sql2012 -Database northwind
$scripts = "C:Northwind"
$release = New-DlmDatabaseRelease -Source $scripts -Target $db
if ($release.Warnings.Details -match "The table S* is being dropped") {
throw "Table being dropped"
}
Comments
SQL Release will always drop tables if they aren't being source controlled. But you do have some ways to stop it.
The simplest way is to add a filter that ignores the tables that are being dropped (https://documentation.red-gate.com/disp ... QL+Release), this works if the tables that are being dropped are always the same ones.
Alternatively you can check all tables into Source Control.
You can add a manual review step or interrogate the warnings with powershell and stop if there is a table drop:
If you mean you want to rename instead of Drop/create you can use Migrations for this https://documentation.red-gate.com/disp ... on+scripts
Peter Gerrard
Developer - DLM Automation
Software Engineer
Redgate Software