-- Migration: 007_CreateWorkCenterTable
-- Source: OLD/Database/Tables/WorkCenter.sql
-- Changes: DATETIME -> DATETIME2(7)

IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'WorkCenter' AND schema_id = SCHEMA_ID('dbo'))
BEGIN
    CREATE TABLE [dbo].[WorkCenter]
    (
        [Code] VARCHAR(12) NOT NULL,
        [Description] VARCHAR(40) NULL,
        [LastUpdateDT] DATETIME2(7) NOT NULL,
        CONSTRAINT [PK_WorkCenter] PRIMARY KEY CLUSTERED([Code])
    );
END
GO

IF NOT EXISTS (SELECT * FROM sys.indexes WHERE name = 'IX_WorkCenter_Lookup' AND object_id = OBJECT_ID('dbo.WorkCenter'))
BEGIN
    CREATE INDEX [IX_WorkCenter_Lookup] ON [dbo].[WorkCenter] ([Description]);
END
GO
