-- Migration: 012b_CreateMisDataCurrTable
-- Source: OLD/Database/Tables/MisData.sql
-- Changes: DATETIME -> DATETIME2(7), split into Hist/Curr tables

IF NOT EXISTS (SELECT * FROM sys.tables WHERE name = 'MisData_Curr' AND schema_id = SCHEMA_ID('dbo'))
BEGIN
    CREATE TABLE [dbo].[MisData_Curr]
    (
        [ItemNumber] VARCHAR(32) NOT NULL,
        [BranchCode] VARCHAR(32) NOT NULL,
        [SequenceNumber] VARCHAR(32) NOT NULL,
        [MisNumber] VARCHAR(32) NOT NULL,
        [RevID] VARCHAR(32) NOT NULL,
        [CharNumber] VARCHAR(32) NOT NULL,
        [TestDescription] VARCHAR(2000) NULL,
        [SamplingType] VARCHAR(32) NULL,
        [SamplingValue] VARCHAR(32) NULL,
        [ToolsGauges] VARCHAR(2000) NULL,
        [WorkInstructions] VARCHAR(2000) NULL,
        [Status] VARCHAR(32) NOT NULL,
        [ReleaseDate] DATETIME2(7) NULL,
        [ObsoleteDate] DATETIME2(7) NULL,
        CONSTRAINT [PK_MisData_Curr] PRIMARY KEY CLUSTERED([ItemNumber], [BranchCode], [SequenceNumber], [MisNumber], [RevID], [Status], [CharNumber])
    );
END
GO
