-- Table ImportHeader
PRINT N'Creating [dbo].[ImportHeader]...';

CREATE TABLE [dbo].[ImportHeader] (
    [Id]               UNIQUEIDENTIFIER NOT NULL,
    [ReportingPartyId] UNIQUEIDENTIFIER NULL,
    [SenderEMail]      NVARCHAR (100)   NULL,
    [ImportDate]       DATETIME         NULL,
    [Filename]         NVARCHAR (100)   NULL,
	[MessageCoreId] UNIQUEIDENTIFIER NOT NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC)
);

GO
ALTER TABLE [dbo].[ImportHeader]
    ADD DEFAULT newid() FOR [Id];

GO

-- Table ImportValue
PRINT N'Creating [dbo].[ImportValue]...';

GO
CREATE TABLE [dbo].[ImportValue] (
    [Id]                UNIQUEIDENTIFIER NOT NULL,
    [ImportHeaderId]    UNIQUEIDENTIFIER NOT NULL,
    [NotificationClass] TINYINT          NULL,
    [Name]              NVARCHAR (128)   NULL,
    [Value]             NVARCHAR (512)   NULL,
    [Identifier]        TINYINT          NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC)
);


GO	
ALTER TABLE [dbo].[ImportValue] ADD DEFAULT newid() FOR [Id];

GO