-- Migration: 011_CreateRouteMasterTable
-- Source: OLD/Database/Tables/RouteMaster.sql
-- Changes: DATETIME -> DATETIME2(7)

IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'RouteMaster' AND schema_id = SCHEMA_ID('dbo'))
BEGIN
    CREATE TABLE [dbo].[RouteMaster]
    (
        [BranchCode] VARCHAR(12) NOT NULL,
        [ItemNumber] VARCHAR(25) NOT NULL,
        [RoutingType] VARCHAR(3) NOT NULL,
        [SequenceNumber] DECIMAL(7, 2) NOT NULL,
        [FunctionCode] VARCHAR(15) NULL,
        [WorkCenterCode] VARCHAR(12) NULL,
        [StartDate] DATETIME2(7) NOT NULL,
        [EndDate] DATETIME2(7) NULL,
        [LastUpdateDT] DATETIME2(7) NOT NULL,
        CONSTRAINT [PK_RouteMaster] PRIMARY KEY CLUSTERED([BranchCode], [ItemNumber], [RoutingType], [SequenceNumber], [StartDate])
    );
END
GO
