Harden scripts and restore workflow
This commit is contained in:
53
sql/playground.sql
Normal file
53
sql/playground.sql
Normal 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
3
sql/test.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
SELECT @@VERSION AS Version;
|
||||
SELECT DB_NAME() AS CurrentDb;
|
||||
SELECT GETDATE() AS CurrentDateTime;
|
||||
Reference in New Issue
Block a user