IF OBJECT_ID(N'[dbo].[Mm_T_MaintenanceInstruction]', 'U') IS NULL BEGIN CREATE TABLE [dbo].[Mm_T_MaintenanceInstruction] ( [Id] uniqueidentifier NOT NULL DEFAULT NEWID(), [TenantId] uniqueidentifier NULL, [BranchId] uniqueidentifier NOT NULL, [Code] nvarchar(32) NULL, [Name] nvarchar(256) NOT NULL, [MaintenanceTypeId] uniqueidentifier NULL, [EquipmentId] uniqueidentifier NOT NULL, [TeamIds] nvarchar(MAX) NULL, [PeriodValue] int NOT NULL DEFAULT 1, [PeriodUnit] nvarchar(16) NOT NULL DEFAULT 'Month', [StartDate] date NOT NULL, [EndDate] date NULL, [NextDueDate] date NULL, [InstructionText] 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_MaintenanceInstruction] 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