CREATE TABLE [dbo].[APRSPackets] (
	[CallsignSSID] [varchar] (9) NOT NULL ,
	[ReportTime] [datetime] NOT NULL ,
	[PacketType] [tinyint] NOT NULL ,
	[IsWx] [bit] NOT NULL ,
	[Packet] [varbinary] (512) NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[APRSPosits] (
	[CallsignSSID] [varchar] (9) NOT NULL ,
	[ReportTime] [datetime] NOT NULL ,
	[Latitude] [float] NOT NULL ,
	[Longitude] [float] NOT NULL ,
	[Course] [smallint] NULL ,
	[Speed] [int] NULL ,
	[Altitude] [int] NULL ,
	[Packet] [varbinary] (512) NULL ,
	[Icon] [char] (2) NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[APRSTrack] (
	[CallsignSSID] [varchar] (9) NOT NULL ,
	[ReportTime] [datetime] NOT NULL ,
	[Latitude] [float] NOT NULL ,
	[Longitude] [float] NOT NULL ,
	[Icon] [char] (2) NULL ,
	[Course] [smallint] NULL ,
	[Speed] [int] NULL ,
	[Altitude] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[APRSWx] (
	[CallsignSSID] [varchar] (9) NOT NULL ,
	[ReportTime] [datetime] NOT NULL ,
	[WindDir] [smallint] NULL ,
	[WindSpeed] [smallint] NULL ,
	[GustSpeed] [smallint] NULL ,
	[Temperature] [smallint] NULL ,
	[HourRain] [decimal](4, 2) NULL ,
	[DayRain] [decimal](6, 2) NULL ,
	[MidnightRain] [decimal](6, 2) NULL ,
	[Humidity] [tinyint] NULL ,
	[BarPressure] [decimal](5, 1) NULL 
) ON [PRIMARY]
GO

 CREATE  INDEX [IX_APRSPackets_RT] ON [dbo].[APRSPackets]([ReportTime]) ON [PRIMARY]
GO

 CREATE  INDEX [IX_APRSTrack_RT] ON [dbo].[APRSTrack]([ReportTime]) ON [PRIMARY]
GO

 CREATE  INDEX [IX_APRSWx_RT] ON [dbo].[APRSWx]([ReportTime]) ON [PRIMARY]
GO

 CREATE  INDEX [IX_APRSPackets] ON [dbo].[APRSPackets]([CallsignSSID], [ReportTime]) ON [PRIMARY]
GO

ALTER TABLE [dbo].[APRSPosits] ADD 
	CONSTRAINT [PK_APRSPosits] PRIMARY KEY  NONCLUSTERED 
	(
		[CallsignSSID]
	) ON [PRIMARY] 
GO

 CREATE  INDEX [IX_APRSPosits] ON [dbo].[APRSPosits]([ReportTime]) ON [PRIMARY]
GO

 CREATE  INDEX [IX_APRSTrack] ON [dbo].[APRSTrack]([CallsignSSID], [ReportTime]) ON [PRIMARY]
GO

 CREATE  INDEX [IX_APRSWx] ON [dbo].[APRSWx]([CallsignSSID], [ReportTime]) ON [PRIMARY]
GO

