Skip to content

Commit 0e2c260

Browse files
committed
Fehlerkorrekturen in Vor und Nach Skripten
1 parent 65f6e6b commit 0e2c260

2 files changed

Lines changed: 13 additions & 16 deletions

File tree

Latest/PD.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ DECLARE @OldMinorVersion AS TINYINT;
55
DECLARE @OldPatchVersion AS TINYINT;
66

77
SELECT TOP (1)
8-
@OldMajorVersion = [vh].[MajorVersion]
9-
,@OldMinorVersion = [vh].[MinorVersion]
10-
,@OldPatchVersion = [vh].[PatchVersion]
8+
@OldMajorVersion = [vh].[MajorVers]
9+
,@OldMinorVersion = [vh].[MinorVers]
10+
,@OldPatchVersion = [vh].[PatchVers]
1111
FROM [dbo].[VersionHistory] [vh]
1212
ORDER BY [vh].[InstallDate] DESC;
1313

Latest/PreDep.sql

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
-- If the dacpac is already deployed to the server, check if the actual installed version is suitable for the new version.
22
-- Throw an error if the new version isn't compatible to the installed version, because a post-deployment script of a previous version has to be performed before.
33

4-
-- Check first, if the database is already installed
5-
IF EXISTS (SELECT TOP (1)
6-
1
7-
FROM [sys].[databases]
8-
WHERE [name] = '$(DatabaseName)')
9-
BEGIN
4+
-- Check first, if the database is already installed and VersionHistory table is available
105

11-
DECLARE @Major AS TINYINT;
12-
DECLARE @Minor AS TINYINT;
13-
DECLARE @Patch AS TINYINT;
6+
DECLARE @Major AS TINYINT;
7+
DECLARE @Minor AS TINYINT;
8+
DECLARE @Patch AS TINYINT;
149

10+
IF OBJECT_ID('[$(DatabaseName)].[dbo].[VersionHistory]') IS NOT NULL
11+
BEGIN
1512
SELECT TOP (1)
16-
@Major = [MajorVersion]
17-
,@Minor = [MinorVersion]
13+
@Major = [MajorVers]
14+
,@Minor = [MinorVers]
1815
,@Patch = [PatchVers]
19-
FROM [$DatabaseName)].[dbo].[VersionHistory]
16+
FROM [$(DatabaseName)].[dbo].[VersionHistory]
2017
ORDER BY [InstallDate] DESC;
2118

2219
-- Check last version if update is applicable
2320
IF ISNULL(@Major, 0) <= 1
2421
AND ISNULL(@Minor, 0) <= 0
25-
AND ISNULL(@Patch, 0) <= 0
22+
AND ISNULL(@Patch, 0) < 0
2623

2724
THROW 50000, 'The actual database version is not compatible with this package version. Update the database prior to version 1.0.0', 1;
2825

0 commit comments

Comments
 (0)