-- Migration: 006_CreateProfitCenterTable
-- Source: OLD/Database/Tables/ProfitCenter.sql
-- Changes: DATETIME -> DATETIME2(7)

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

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