/* Closing support cases from SQLInsight Web (the /support page or POST /api/v1/support-cases/{id}/close): the web UI records the request, the agent sends it to SQLInsight Hub and sets Closed when the hub has confirmed it. A request on a case without a number yet is sent once the hub has created the case. */ ALTER TABLE insight.SupportCases ADD CloseRequestedAt datetime2(0) NULL, CloseRequestedBy nvarchar(256) NULL, CloseComment nvarchar(1000) NULL, CloseAttempts int NOT NULL CONSTRAINT DF_SupportCases_CloseAttempts DEFAULT (0), CloseNextAttemptAt datetime2(0) NULL, ClosedBy nvarchar(300) NULL; GO ALTER TABLE insight.SupportCases DROP CONSTRAINT CK_SupportCases_Status; ALTER TABLE insight.SupportCases ADD CONSTRAINT CK_SupportCases_Status CHECK (Status IN ('Pending', 'Open', 'CloseRequested', 'Closed', 'Failed')); GO /* Like INSERT in 0005: the web UI may record a close request on these columns only. */ GRANT UPDATE ON insight.SupportCases (CloseRequestedAt, CloseRequestedBy, CloseComment, CloseNextAttemptAt, Status, UpdatedAt) TO public;