Harden scripts and restore workflow

This commit is contained in:
2026-01-30 16:35:40 +01:00
parent 4a905eeaaa
commit eb3264ba0f
3 changed files with 289 additions and 0 deletions

53
sql/playground.sql Normal file
View File

@@ -0,0 +1,53 @@
/* ------------------------------------------------------------
sql/playground.sql
Local playground for SQL Server 2025 in Docker
------------------------------------------------------------ */
-- Basic server info
SELECT
@@SERVERNAME AS ServerName,
@@VERSION AS SqlServerVersion,
SYSDATETIME() AS ServerTimeLocal,
SYSUTCDATETIME() AS ServerTimeUtc;
-- Switch to your dev database (created by seed/migrations)
IF DB_ID(N'DevDb') IS NULL
BEGIN
PRINT 'Database DevDb does not exist yet. Run: ./scripts/seed.sh and ./scripts/migrate.sh';
RETURN;
END
GO
USE DevDb;
GO
SELECT DB_NAME() AS CurrentDatabase;
GO
-- Check if example table exists and query it
IF OBJECT_ID(N'dbo.Customer', N'U') IS NULL
BEGIN
PRINT 'Table dbo.Customer does not exist yet. Run: ./scripts/migrate.sh';
END
ELSE
BEGIN
PRINT 'dbo.Customer exists. Running sample queries...';
SELECT TOP (10) *
FROM dbo.Customer
ORDER BY CustomerId DESC;
SELECT COUNT(*) AS CustomerCount
FROM dbo.Customer;
END
GO
/* ------------------------------------------------------------
Scratch area (write your own queries below)
------------------------------------------------------------ */
-- Example:
-- SELECT TOP (100) *
-- FROM dbo.Customer
-- ORDER BY CustomerId;

3
sql/test.sql Normal file
View File

@@ -0,0 +1,3 @@
SELECT @@VERSION AS Version;
SELECT DB_NAME() AS CurrentDb;
SELECT GETDATE() AS CurrentDateTime;