45 lines
1.9 KiB
MySQL
45 lines
1.9 KiB
MySQL
|
|
IF OBJECT_ID(N'[dbo].[Mm_T_WorkOrder]', 'U') IS NULL
|
||
|
|
BEGIN
|
||
|
|
CREATE TABLE [dbo].[Mm_T_WorkOrder]
|
||
|
|
(
|
||
|
|
[Id] uniqueidentifier NOT NULL DEFAULT NEWID(),
|
||
|
|
[TenantId] uniqueidentifier NULL,
|
||
|
|
[BranchId] uniqueidentifier NOT NULL,
|
||
|
|
[WorkOrderNo] nvarchar(32) NULL,
|
||
|
|
[Name] nvarchar(256) NOT NULL,
|
||
|
|
[EquipmentId] uniqueidentifier NOT NULL,
|
||
|
|
[RequestDate] date NULL,
|
||
|
|
[MaintenanceKind] nvarchar(16) NOT NULL DEFAULT 'Corrective',
|
||
|
|
[ResourceType] nvarchar(16) NOT NULL DEFAULT 'Internal',
|
||
|
|
[MaintenanceTypeId] uniqueidentifier NULL,
|
||
|
|
[TeamId] uniqueidentifier NULL,
|
||
|
|
[Source] nvarchar(16) NOT NULL DEFAULT 'Manual',
|
||
|
|
[MaintenanceInstructionId] uniqueidentifier NULL,
|
||
|
|
[ResponsibleUserId] uniqueidentifier NULL,
|
||
|
|
[PlannedStart] datetime NULL,
|
||
|
|
[PlannedEnd] datetime NULL,
|
||
|
|
[ActualStart] datetime NULL,
|
||
|
|
[ActualEnd] datetime NULL,
|
||
|
|
[Priority] int NOT NULL DEFAULT 0,
|
||
|
|
[Status] nvarchar(16) NOT NULL DEFAULT 'Draft',
|
||
|
|
[Notes] nvarchar(MAX) NULL,
|
||
|
|
[DeptApproverUserNames] nvarchar(MAX) NULL,
|
||
|
|
[ApprovalUserName] nvarchar(256) NULL,
|
||
|
|
[ApprovalStatus] nvarchar(50) NULL,
|
||
|
|
[ApprovalDate] datetime NULL,
|
||
|
|
[ApprovalDescription] nvarchar(200) NULL,
|
||
|
|
[IsActive] bit NOT NULL DEFAULT 1,
|
||
|
|
[CreationTime] datetime2 NOT NULL DEFAULT GETUTCDATE(),
|
||
|
|
[CreatorId] uniqueidentifier NULL,
|
||
|
|
[LastModificationTime] datetime2 NULL,
|
||
|
|
[LastModifierId] uniqueidentifier NULL,
|
||
|
|
[IsDeleted] bit NOT NULL DEFAULT 0,
|
||
|
|
[DeletionTime] datetime2 NULL,
|
||
|
|
[DeleterId] uniqueidentifier NULL,
|
||
|
|
CONSTRAINT [PK_Mm_T_WorkOrder] PRIMARY KEY NONCLUSTERED
|
||
|
|
(
|
||
|
|
[Id] ASC
|
||
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
|
||
|
|
) ON [PRIMARY]
|
||
|
|
END
|
||
|
|
GO
|