
PRINT N'Altering [dbo].[WAS]...';
GO

ALTER TABLE [dbo].[WAS]
    ADD [NextWasteDisposalPort] NCHAR (5) NULL;
GO

PRINT N'Creating [dbo].[WAS_RCPT]...';

GO
CREATE TABLE [dbo].[WAS_RCPT] (
    [Id]                                UNIQUEIDENTIFIER NOT NULL,
    [MessageHeaderId]                   UNIQUEIDENTIFIER NULL,
    [IdentificationNumber]              NVARCHAR (20)    NULL,
    [PortReceptionFacilityName]         NVARCHAR (70)    NULL,
    [PortReceptionFacilityProviderName] NVARCHAR (70)    NULL,
    [WasteDeliveryDateFrom]             DATETIME         NULL,
    [WasteDeliveryDateTo]               DATETIME         NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC)
);

GO

PRINT N'Creating [dbo].[FK_WAS_RCPT_MessageHeader]...';
GO

ALTER TABLE [dbo].[WAS_RCPT] WITH NOCHECK
    ADD CONSTRAINT [FK_WAS_RCPT_MessageHeader] FOREIGN KEY ([MessageHeaderId]) REFERENCES [dbo].[MessageHeader] ([Id]);
GO

ALTER TABLE [dbo].[WAS_RCPT] WITH CHECK CHECK CONSTRAINT [FK_WAS_RCPT_MessageHeader];
GO


PRINT N'Creating [dbo].[TreatmentFacilityProvider]...';
GO

CREATE TABLE [dbo].[TreatmentFacilityProvider] (
    [Id]                            UNIQUEIDENTIFIER NOT NULL,
    [WAS_RCPTId]                    UNIQUEIDENTIFIER NULL,
    [TreatmentFacilityProviderName] NVARCHAR (70)    NULL,
    [Identifier]                    NVARCHAR (50)    NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC)
);

PRINT N'Creating [dbo].[FK_TreatmentFacilityProvider_WAS_RCPT]...';
GO

ALTER TABLE [dbo].[TreatmentFacilityProvider] WITH NOCHECK
    ADD CONSTRAINT [FK_TreatmentFacilityProvider_WAS_RCPT] FOREIGN KEY ([WAS_RCPTId]) REFERENCES [dbo].[WAS_RCPT] ([Id]);
GO

ALTER TABLE [dbo].[TreatmentFacilityProvider] WITH CHECK CHECK CONSTRAINT [FK_TreatmentFacilityProvider_WAS_RCPT];
GO


PRINT N'Creating [dbo].[WasteReceived]...';
GO

CREATE TABLE [dbo].[WasteReceived] (
    [Id]                      UNIQUEIDENTIFIER NOT NULL,
    [WAS_RCPTId]              UNIQUEIDENTIFIER NULL,
    [WasteCode]               NCHAR (3)        NULL,
    [WasteDescription]        NVARCHAR (256)   NULL,
    [AmountWasteReceived_MTQ] FLOAT (53)       NULL,
    [Identifier]              NVARCHAR (50)    NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC)
);
GO

PRINT N'Creating [dbo].[FK_WasteReceived_WAS_RCPT]...';
GO

ALTER TABLE [dbo].[WasteReceived] WITH NOCHECK
    ADD CONSTRAINT [FK_WasteReceived_WAS_RCPT] FOREIGN KEY ([WAS_RCPTId]) REFERENCES [dbo].[WAS_RCPT] ([Id]);
GO

ALTER TABLE [dbo].[WasteReceived] WITH CHECK CHECK CONSTRAINT [FK_WasteReceived_WAS_RCPT];
GO

PRINT N'Altering [dbo].[CREW]...';
GO

ALTER TABLE [dbo].[CREW]
    ADD [NotificationSchengen] BIT NULL,
        [NotificationPAX]      BIT NULL;
GO

PRINT N'Altering [dbo].[PAS]...';
GO

ALTER TABLE [dbo].[PAS]
    ADD [NotificationSchengen] BIT NULL,
        [NotificationPAX]      BIT NULL;
GO

PRINT N'Altering [dbo].[IMDGPosition]...';
GO

ALTER TABLE [dbo].[IMDGPosition]
    ADD [Class7MaxActivity_Unit] TINYINT NULL;
GO

PRINT N'Altering [dbo].[PAS]...';

GO
ALTER TABLE [dbo].[PAS]
    ADD [EmergencyCare]          NVARCHAR (255) NULL,
        [EmergencyContactNumber] NVARCHAR (99)  NULL;

GO