-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdatabase002_seed_reference_data.sql
More file actions
67 lines (63 loc) · 1.66 KB
/
Copy pathdatabase002_seed_reference_data.sql
File metadata and controls
67 lines (63 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
SET NOCOUNT ON;
GO
MERGE dbo.SessionStatuses AS target
USING
(
VALUES
(1, N'Active'),
(2, N'Ended'),
(3, N'Abandoned')
) AS source (SessionStatusId, StatusName)
ON target.SessionStatusId = source.SessionStatusId
WHEN MATCHED THEN
UPDATE SET StatusName = source.StatusName
WHEN NOT MATCHED THEN
INSERT (SessionStatusId, StatusName)
VALUES (source.SessionStatusId, source.StatusName);
GO
MERGE dbo.PaymentStatuses AS target
USING
(
VALUES
(1, N'Pending'),
(2, N'Completed'),
(3, N'Failed'),
(4, N'Refunded')
) AS source (PaymentStatusId, StatusName)
ON target.PaymentStatusId = source.PaymentStatusId
WHEN MATCHED THEN
UPDATE SET StatusName = source.StatusName
WHEN NOT MATCHED THEN
INSERT (PaymentStatusId, StatusName)
VALUES (source.PaymentStatusId, source.StatusName);
GO
MERGE dbo.ProcessingStatuses AS target
USING
(
VALUES
(1, N'Pending'),
(2, N'Applied'),
(3, N'Rejected')
) AS source (ProcessingStatusId, StatusName)
ON target.ProcessingStatusId = source.ProcessingStatusId
WHEN MATCHED THEN
UPDATE SET StatusName = source.StatusName
WHEN NOT MATCHED THEN
INSERT (ProcessingStatusId, StatusName)
VALUES (source.ProcessingStatusId, source.StatusName);
GO
MERGE dbo.LedgerEntryTypes AS target
USING
(
VALUES
(1, N'TopUp'),
(2, N'Debit'),
(3, N'Refund')
) AS source (LedgerEntryTypeId, TypeName)
ON target.LedgerEntryTypeId = source.LedgerEntryTypeId
WHEN MATCHED THEN
UPDATE SET TypeName = source.TypeName
WHEN NOT MATCHED THEN
INSERT (LedgerEntryTypeId, TypeName)
VALUES (source.LedgerEntryTypeId, source.TypeName);
GO