Initial commit: SQL Server 2025 local dev stack
This commit is contained in:
12
db/migrations/2026-01-30_001_create_customer.sql
Normal file
12
db/migrations/2026-01-30_001_create_customer.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
USE DevDb;
|
||||
GO
|
||||
|
||||
IF OBJECT_ID('dbo.Customer', 'U') IS NULL
|
||||
BEGIN
|
||||
CREATE TABLE dbo.Customer(
|
||||
CustomerId int IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
||||
Name nvarchar(200) NOT NULL,
|
||||
CreatedAt datetime2 NOT NULL CONSTRAINT DF_Customer_CreatedAt DEFAULT (sysutcdatetime())
|
||||
);
|
||||
END
|
||||
GO
|
||||
5
db/seed/001_create_db.sql
Normal file
5
db/seed/001_create_db.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
IF DB_ID('DevDb') IS NULL
|
||||
BEGIN
|
||||
CREATE DATABASE DevDb;
|
||||
END
|
||||
GO
|
||||
9
db/seed/020_seed_customers.sql
Normal file
9
db/seed/020_seed_customers.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
USE DevDb;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT 1 FROM dbo.Customer WHERE Name = N'Alice')
|
||||
INSERT INTO dbo.Customer(Name) VALUES (N'Alice');
|
||||
|
||||
IF NOT EXISTS (SELECT 1 FROM dbo.Customer WHERE Name = N'Bob')
|
||||
INSERT INTO dbo.Customer(Name) VALUES (N'Bob');
|
||||
GO
|
||||
Reference in New Issue
Block a user