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

GO
CREATE TABLE [dbo].[aisposreport] (
    [Id]           UNIQUEIDENTIFIER NOT NULL,
    [MMSI]         INT              NOT NULL,
    [NavStatus]    INT              NULL,
    [ROT]          INT              NULL,
    [COG]          INT              NULL,
    [SOG]          INT              NULL,
    [Accuracy]     INT              NULL,
    [Longitude]    INT              NULL,
    [Latitude]     INT              NULL,
    [Heading]      INT              NULL,
    [Timestamp]    DATETIME         NULL,
    [Reserved]     INT              NULL,
    [Spare]        INT              NULL,
    [Raim]         INT              NULL,
    [CommState]    INT              NULL,
    [AISStationId] UNIQUEIDENTIFIER NOT NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC)
);

GO

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

GO

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

GO
CREATE TABLE [dbo].[aisstation] (
    [Id]         UNIQUEIDENTIFIER NOT NULL,
    [lat]        INT              NULL,
    [lon]        INT              NULL,
    [telnetHost] NVARCHAR (255)   NULL,
    [telnetPort] INT              NULL,
    [comPort]    NVARCHAR (10)    NULL,
    [name]       NVARCHAR (255)   NULL,
    [baudrate]   INT              NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC)
);

GO

PRINT N'Creating unnamed constraint on [dbo].[aisstation]...';

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

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


GO
CREATE TABLE [dbo].[aisstaticdata] (
    [Id]                     UNIQUEIDENTIFIER NOT NULL,
    [aisversion]             INT              NULL,
    [imoNumber]              INT              NULL,
    [callsign]               NVARCHAR (10)    NULL,
    [name]                   NVARCHAR (100)   NULL,
    [shiptype]               INT              NULL,
    [dimension]              INT              NULL,
    [a]                      INT              NULL,
    [b]                      INT              NULL,
    [c]                      INT              NULL,
    [d]                      INT              NULL,
    [typeofdevice]           INT              NULL,
    [etamonth]               INT              NULL,
    [etaday]                 INT              NULL,
    [etahour]                INT              NULL,
    [etaminute]              INT              NULL,
    [maxpresetstaticdraught] INT              NULL,
    [destination]            NVARCHAR (255)   NULL,
    [dte]                    INT              NULL,
    [spare]                  INT              NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC)
);

GO
PRINT N'Creating unnamed constraint on [dbo].[aisstaticdata]...';

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

GO

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

GO
CREATE TABLE [dbo].[hotposition] (
    [Id]   UNIQUEIDENTIFIER NOT NULL,
    [mmsi] INT              NULL,
    [pid]  UNIQUEIDENTIFIER NOT NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC)
);


GO

PRINT N'Creating unnamed constraint on [dbo].[aisstaticdata]...';

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

GO