-
Notifications
You must be signed in to change notification settings - Fork 0
/
V202410231550__v2.10.Enhance_Integrations_Schema.sql
34 lines (30 loc) · 1.52 KB
/
V202410231550__v2.10.Enhance_Integrations_Schema.sql
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
-- Alter the table to add new columns
ALTER TABLE ${flyway:defaultSchema}.CompanyIntegrationRun
ADD
[Status] NVARCHAR(20) NOT NULL DEFAULT 'Pending',
ErrorLog NVARCHAR(MAX) NULL,
ConfigData NVARCHAR(MAX) NULL;
GO
-- Add check constraint for Status column
ALTER TABLE ${flyway:defaultSchema}.CompanyIntegrationRun
ADD CONSTRAINT CK_CompanyIntegrationRun_Status
CHECK ([Status] IN ('Pending', 'In Progress', 'Success', 'Failed'));
-- Add extended properties for the new columns
EXEC sp_addextendedproperty
@name = N'MS_Description',
@value = N'Status of the integration run. Possible values: Pending, In Progress, Success, Failed.',
@level0type = N'Schema', @level0name = '${flyway:defaultSchema}',
@level1type = N'Table', @level1name = 'CompanyIntegrationRun',
@level2type = N'Column', @level2name = 'Status';
EXEC sp_addextendedproperty
@name = N'MS_Description',
@value = N'Optional error log information for the integration run.',
@level0type = N'Schema', @level0name = '${flyway:defaultSchema}',
@level1type = N'Table', @level1name = 'CompanyIntegrationRun',
@level2type = N'Column', @level2name = 'ErrorLog';
EXEC sp_addextendedproperty
@name = N'MS_Description',
@value = N'Optional configuration data in JSON format for the request that started the integration run for audit purposes.',
@level0type = N'Schema', @level0name = '${flyway:defaultSchema}',
@level1type = N'Table', @level1name = 'CompanyIntegrationRun',
@level2type = N'Column', @level2name = 'ConfigData';