update export request
This commit is contained in:
@@ -1404,3 +1404,39 @@ BEGIN CATCH
|
||||
END CATCH;
|
||||
|
||||
GO
|
||||
|
||||
GO
|
||||
-- Project export approval workflow. Preserves legacy exports.
|
||||
SET XACT_ABORT ON;
|
||||
BEGIN TRY
|
||||
BEGIN TRANSACTION;
|
||||
IF OBJECT_ID('dbo.AssetExportRequests', 'U') IS NULL
|
||||
BEGIN
|
||||
CREATE TABLE dbo.AssetExportRequests (
|
||||
ExportRequestId INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
||||
RequesterName NVARCHAR(100) NOT NULL,
|
||||
ItemsJson NVARCHAR(MAX) NOT NULL,
|
||||
RequestNote NVARCHAR(1000) NULL,
|
||||
RequestStatus NVARCHAR(20) NOT NULL DEFAULT 'pending',
|
||||
CreatedBy INT NOT NULL,
|
||||
CreatedDate DATETIME NOT NULL DEFAULT (DATEADD(HOUR, 7, SYSUTCDATETIME())),
|
||||
ProcessedBy INT NULL,
|
||||
ProcessedByName NVARCHAR(100) NULL,
|
||||
ProcessedDate DATETIME NULL,
|
||||
RejectReason NVARCHAR(1000) NULL,
|
||||
ExportDocumentId UNIQUEIDENTIFIER NULL,
|
||||
CONSTRAINT CK_AssetExportRequests_Status CHECK (RequestStatus IN ('pending', 'approved', 'rejected')),
|
||||
CONSTRAINT FK_AssetExportRequests_User FOREIGN KEY (CreatedBy) REFERENCES dbo.Users(UserId),
|
||||
CONSTRAINT FK_AssetExportRequests_Document FOREIGN KEY (ExportDocumentId) REFERENCES dbo.AssetExportDocuments(ExportDocumentId)
|
||||
);
|
||||
CREATE INDEX IX_AssetExportRequests_Creator ON dbo.AssetExportRequests(CreatedBy, CreatedDate DESC);
|
||||
CREATE INDEX IX_AssetExportRequests_Status ON dbo.AssetExportRequests(RequestStatus, CreatedDate DESC);
|
||||
END;
|
||||
COMMIT TRANSACTION;
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION;
|
||||
THROW;
|
||||
END CATCH;
|
||||
|
||||
GO
|
||||
|
||||
Reference in New Issue
Block a user