Simplify DB to six tables and load credentials via Always Encrypted SonicCredential.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-29 08:23:55 +02:00
co-authored by Cursor
parent 4d19873776
commit dcfcb5289d
15 changed files with 1356 additions and 461 deletions
@@ -0,0 +1,36 @@
/*
DATABASE: [master]
OBJECTNAME: DropExisting
ACTION: DROP
IDX: 001
DATE: 2026-07-29
USER: CUR
COMMENT: Loescht die befuellte Alt-DB (Tippfehler-Name) und die Ziel-DB
vollstaendig inkl. aller Tabellen und Always-Encrypted-Keys
(CMK/CEK). Danach: 01_CreateDatabase -> 02_CreateSchema -> 03_Seed.
Voraussetzung Client: Always-Encrypted-Zertifikat mit Thumbprint
aus appsettings (CurrentUser\My) muss vorhanden bleiben.
ACHTUNG: destruktiv, keine Datenmigration.
*/
USE [master];
GO
/* Alte DB mit Tippfehler im Namen */
IF DB_ID(N'EsbZertifkatManager') IS NOT NULL
BEGIN
ALTER DATABASE [EsbZertifkatManager]
SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DROP DATABASE [EsbZertifkatManager];
END;
GO
/* Ziel-DB (falls bereits angelegt / befuellt) */
IF DB_ID(N'EsbZertifikatManager') IS NOT NULL
BEGIN
ALTER DATABASE [EsbZertifikatManager]
SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DROP DATABASE [EsbZertifikatManager];
END;
GO