You are on page 1of 30

USE [mts]

GO
/****** Object: Table [dbo].[rawDataCarSky]
Script Date: 03/05/2013 12:50:42
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[rawDataCarSky](
[Id] [int] IDENTITY(1,1) NOT NULL,
[imei] [bigint] NOT NULL,
[time] [datetime] NOT NULL,
[latitude] [float] NULL,
[longitude] [float] NULL,
[speed] [float] NULL,
[angle] [int] NULL,
[GSMSignalStrength] [int] NULL,
[CurrentProfile] [int] NULL,
[GPSSpeed] [float] NULL,
[BatteryVoltage] [float] NULL,
[addressFId] [int] NULL,
[cellId] [bigint] NULL,
[operatorCode] [bigint] NULL,
[lac] [float] NULL,
[mcc] [float] NULL,
[pdop] [float] NULL,
[operateCode] [bigint] NULL,
CONSTRAINT [PK_rawDataCarSky] PRIMARY KEY CLUSTERED
(
[imei] ASC,
[time] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[VehicleStatus]
Script Date: 03/05/2013 12:50:42
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VehicleStatus](
[StatusID] [int] NOT NULL,
[VehicleFID] [int] NULL,
[Time] [datetime] NULL,
[IgnitionStatus] [int] NULL,
[DoorStatus] [int] NULL,
[AcStatus] [int] NULL,
[FuelStatus] [int] NULL,
[RPM] [int] NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[users]
Script Date: 03/05/2013 12:50:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[users](

[ID] [int] IDENTITY(1,1) NOT NULL,


[loginID] [varchar](50) NOT NULL,
[UserName] [varchar](50) NULL,
[LoginPwd] [varchar](50) NOT NULL,
[Role] [int] NOT NULL,
[fk_OrgID] [int] NULL,
[fk_CompanyID] [int] NULL,
[Email] [varchar](160) NULL,
[Details] [varchar](50) NULL,
[CreatedBy] [int] NULL,
[CreatedOn] [datetime] NULL,
[expiresOn] [datetime] NULL,
[DNNUserId] [int] NULL,
[CompanyLimit] [int] NULL,
CONSTRAINT [PK_users] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[userRolesNew]
Script Date: 03/05/2013 12:50:42
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[userRolesNew](
[roleId] [int] IDENTITY(1,1) NOT NULL,
[roleName] [varchar](50) NOT NULL,
[rolePriority] [int] NULL,
CONSTRAINT [PK_userRole] PRIMARY KEY CLUSTERED
(
[roleId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[userRoles]
Script Date: 03/05/2013 12:50:42 ***
***/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[userRoles](
[roleId] [int] IDENTITY(1,1) NOT NULL,
[roleName] [varchar](50) NOT NULL,
[rolePriority] [int] NULL,
CONSTRAINT [PK_userRoles] PRIMARY KEY CLUSTERED
(
[roleId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL

LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]


) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[UserDetails]
Script Date: 03/05/2013 12:50:42 *
*****/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[UserDetails](
[UserID] [int] IDENTITY(1,1) NOT NULL,
[UserAddr] [nvarchar](255) NULL,
[UserType] [varchar](50) NULL,
CONSTRAINT [PK_UserDetails] PRIMARY KEY CLUSTERED
(
[UserID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[trackType]
Script Date: 03/05/2013 12:50:42 ***
***/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[trackType](
[trackTypeID] [int] IDENTITY(1,1) NOT NULL,
[trackType] [varchar](50) NULL,
[description] [varchar](550) NULL,
[codecID] [int] NULL,
CONSTRAINT [PK_trackType] PRIMARY KEY CLUSTERED
(
[trackTypeID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[trackpoint_in]
Script Date: 03/05/2013 12:50:42
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[trackpoint_in](
[UUID] [nvarchar](108) NOT NULL,
[UNITID] [bigint] NOT NULL,
[TRACKINGTIME] [datetime] NOT NULL,
[GPSSTATUS] [nvarchar](1) NOT NULL,
[LONGITUDE] [float] NOT NULL,

[LATITUDE] [float] NOT NULL,


[SPEED] [float] NOT NULL,
[MILEAGE] [float] NULL,
[DIRECTION] [float] NOT NULL,
[ISTATUS] [nvarchar](255) NOT NULL,
[SSTATUS] [nvarchar](1) NULL,
[INPUTSTATUS] [nvarchar](60) NULL,
[TT1] [float] NULL,
[TT2] [float] NULL,
[TT3] [float] NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[towingOn]
Script Date: 03/05/2013 12:50:42 ****
**/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[towingOn](
[Id] [int] IDENTITY(1,1) NOT NULL,
[carrierFId] [int] NULL,
[time] [datetime] NULL,
CONSTRAINT [PK_towingOn] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[towerLocation]
Script Date: 03/05/2013 12:50:42
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[towerLocation](
[Id] [int] IDENTITY(1,1) NOT NULL,
[mnc] [int] NULL,
[mcc] [int] NULL,
[lac] [int] NULL,
[towerId] [int] NULL,
[towerLat] [float] NULL,
[towerlong] [float] NULL,
CONSTRAINT [PK_towerLocation] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[timeZone]
Script Date: 03/05/2013 12:50:42 ****
**/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[timeZone](
[zoneId] [int] IDENTITY(1,1) NOT NULL,

[zoneOffsetHr] [int] NOT NULL,


[zoneOffsetMin] [int] NOT NULL,
[zoneOffsetSign] [int] NOT NULL,
[zoneName] [varchar](150) NULL,
[zone] [nvarchar](50) NULL,
CONSTRAINT [PK_timeZoneOffset] PRIMARY KEY CLUSTERED
(
[zoneId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[tikerFeed]
Script Date: 03/05/2013 12:50:42 ***
***/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tikerFeed](
[feedID] [int] IDENTITY(1,1) NOT NULL,
[feed] [nchar](10) NULL,
[feedTime] [datetime] NULL,
[feedLat] [float] NULL,
[feedlong] [float] NULL,
[carrierFId] [int] NULL,
CONSTRAINT [PK_tikerFeed] PRIMARY KEY CLUSTERED
(
[feedID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[tb_Icons]
Script Date: 03/05/2013 12:50:42 ****
**/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tb_Icons](
[iconId] [int] IDENTITY(1,1) NOT NULL,
[OrgFid] [int] NULL,
[Move] [nvarchar](max) NULL,
[NonMove] [nvarchar](max) NULL,
[Overspeed] [nvarchar](max) NULL,
[LBS] [nvarchar](max) NULL,
[Personal] [nvarchar](max) NULL,
[Stop] [nvarchar](max) NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[smtpEmail]
Script Date: 03/05/2013 12:50:42 ***
***/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[smtpEmail](

[id] [int] IDENTITY(1,1) NOT NULL,


[emailID] [varchar](50) NOT NULL,
[Password] [varchar](50) NOT NULL,
[port] [varchar](50) NULL,
[smtp] [varchar](50) NULL,
[sp] [varchar](50) NULL,
CONSTRAINT [PK_smtpEmail] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[Company]
Script Date: 03/05/2013 12:50:41 *****
*/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Company](
[companyID] [int] IDENTITY(1,1) NOT NULL,
[companyName] [nvarchar](255) NOT NULL,
[companyWebsite] [nvarchar](255) NULL,
[companyEmail] [varchar](50) NULL,
[companyContact] [bigint] NULL,
[companyAddr] [varchar](50) NULL,
[createdOn] [datetime] NULL,
[expiryOn] [datetime] NULL,
[logo] [varchar](500) NULL,
[Status] [varchar](50) NULL,
[OrganisationLimit] [int] NULL,
[CarrierLimit] [int] NULL,
[UsersLimit] [int] NULL,
[UserID] [int] NULL,
CONSTRAINT [PK_CompanyDetails] PRIMARY KEY CLUSTERED
(
[companyID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[carrierUsers]
Script Date: 03/05/2013 12:50:41
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[carrierUsers](
[ID] [int] IDENTITY(1,1) NOT NULL,
[userID] [int] NULL,
[carrierID] [int] NULL,
CONSTRAINT [PK_carrierUsers] PRIMARY KEY CLUSTERED
(
[ID] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL


LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[alerts]
Script Date: 03/05/2013 12:50:41 ******
/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[alerts](
[alertId] [int] IDENTITY(1,1) NOT NULL,
[alertMessage] [varchar](160) NOT NULL,
[alertPriority] [int] NULL,
[alertRelatedTo] [varchar](50) NULL,
[priority] [int] NULL,
[timeout] [int] NULL,
CONSTRAINT [PK_alerts] PRIMARY KEY CLUSTERED
(
[alertId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[DriverPerformance]
Script Date: 03/05/2013 12:5
0:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DriverPerformance](
[DPID] [int] NOT NULL,
[EventDateTime] [datetime] NULL,
[PScale] [int] NULL,
[PerfDescription] [nvarchar](255) NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[DriverDetails]
Script Date: 03/05/2013 12:50:42
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DriverDetails](
[DriverID] [int] NOT NULL,
[DriverRFID] [nvarchar](255) NULL,
[DriverName] [nvarchar](255) NULL,
[DriverDOB] [datetime] NULL,
[DriverAddress] [nvarchar](255) NULL,
[DriverCell1] [int] NULL,
[DriverCell2] [int] NULL,
[DriverIdentMark] [nvarchar](255) NULL,
[DriverBloodGroup] [nvarchar](255) NULL,
[DriverExp] [int] NULL
) ON [PRIMARY]
GO

/****** Object: Table [dbo].[doorStatus]


Script Date: 03/05/2013 12:50:41 **
****/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[doorStatus](
[smsId] [int] IDENTITY(1,1) NOT NULL,
[alertTime] [datetime] NULL,
[carrierFid] [int] NULL,
[din2Status] [int] NULL,
CONSTRAINT [PK_doorStatus] PRIMARY KEY CLUSTERED
(
[smsId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[din4OnOff]
Script Date: 03/05/2013 12:50:41 ***
***/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[din4OnOff](
[Id] [int] IDENTITY(1,1) NOT NULL,
[carrierFId] [int] NOT NULL,
[time] [datetime] NOT NULL,
[latitude] [float] NULL,
[longitude] [float] NULL,
[speed] [float] NULL,
[Din4] [int] NULL,
CONSTRAINT [PK_din4OnOff] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[din3OnOff]
Script Date: 03/05/2013 12:50:41 ***
***/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[din3OnOff](
[Id] [int] IDENTITY(1,1) NOT NULL,
[carrierFId] [int] NOT NULL,
[time] [datetime] NOT NULL,
[latitude] [float] NULL,
[longitude] [float] NULL,
[speed] [float] NULL,
[Din3] [int] NULL,
CONSTRAINT [PK_din3OnOff] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

/****** Object: Table [dbo].[DeviceRecords]


Script Date: 03/05/2013 12:50:41
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DeviceRecords](
[RecordID] [int] NOT NULL,
[DeviceFid] [int] NULL,
[RecordTime] [datetime] NULL,
[RecordLatitude] [int] NULL,
[RecordLongitude] [int] NULL,
[RecordAltitude] [int] NULL,
[RecordAngle] [int] NULL,
[RecordSatCount] [int] NULL,
[Speed] [int] NULL,
[Landmark] [nvarchar](255) NULL,
[IgnitionStatus] [int] NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[ManDetails]
Script Date: 03/05/2013 12:50:42 **
****/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ManDetails](
[ManID] [int] NOT NULL,
[ManName] [nvarchar](255) NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[LoginDetails]
Script Date: 03/05/2013 12:50:42
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LoginDetails](
[ID] [int] NOT NULL,
[LoginID] [nvarchar](255) NULL,
[Password] [nvarchar](255) NULL,
[UserType] [nvarchar](255) NULL,
[UserPriority] [int] NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[LicenseType]
Script Date: 03/05/2013 12:50:42 *
*****/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LicenseType](
[Id] [int] IDENTITY(1,1) NOT NULL,
[LicenseType] [nvarchar](255) NOT NULL,
CONSTRAINT [PK_LicenseType] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object: Table [dbo].[LicenseDetails]
Script Date: 03/05/2013 12:50:4
2 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LicenseDetails](
[LicenseDetailsID] [int] NOT NULL,
[LicenseImage] [nvarchar](max) NULL,
[LicenseExpiryDate] [datetime] NULL,
[LicenseNumber] [nvarchar](255) NULL,
[DriverFID] [int] NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[globle_Values]
Script Date: 03/05/2013 12:50:42
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[globle_Values](
[gl_id] [int] IDENTITY(1,1) NOT NULL,
[din1] [tinyint] NULL,
CONSTRAINT [PK_globle_Values] PRIMARY KEY CLUSTERED
(
[gl_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[IndividualDetails]
Script Date: 03/05/2013 12:5
0:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[IndividualDetails](
[CustomerID] [int] NOT NULL,
[CustomerName] [nvarchar](255) NULL,
[CustomerLandline] [int] NULL,
[CustomerDOB] [datetime] NULL,
[CustomerUniqueIDNo] [nvarchar](255) NULL,
[CustomerBloodGroup] [nvarchar](255) NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[fifteenDayData]
Script Date: 03/05/2013 12:50:4
2 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[fifteenDayData](
[Id] [int] IDENTITY(1,1) NOT NULL,
[carrierFId] [int] NOT NULL,
[time] [datetime] NOT NULL,
[codecId] [int] NULL,
[priority] [int] NULL,
[latitude] [float] NULL,
[longitude] [float] NULL,

[altitude] [float] NULL,


[sat] [int] NULL,
[speed] [float] NULL,
[angle] [int] NULL,
[Din1] [int] NULL,
[Din2] [int] NULL,
[Din3] [int] NULL,
[Din4] [int] NULL,
[Analog1] [float] NULL,
[Analog2] [float] NULL,
[Analog3] [float] NULL,
[Analog4] [float] NULL,
[GSMSignalStrength] [int] NULL,
[CurrentProfile] [int] NULL,
[GPSSpeed] [float] NULL,
[BatteryVoltage] [float] NULL,
[BatteryCurrent] [float] NULL,
[PcbTemp] [float] NULL,
[FuelCounter] [bigint] NULL,
[MovementSensor] [int] NULL,
[Dallas0] [float] NULL,
[Dallas1] [float] NULL,
[Dallas2] [float] NULL,
[IButton] [bigint] NULL,
[Odometer] [int] NULL,
[addressFId] [int] NULL,
[lbsLocation] [tinyint] NULL,
CONSTRAINT [PK_fifteenDayData] PRIMARY KEY CLUSTERED
(
[carrierFId] ASC,
[time] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[ServiceProviderDetails]
Script Date: 03/05/2013
12:50:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ServiceProviderDetails](
[ServicePID] [int] NOT NULL,
[ServicePName] [nvarchar](255) NULL
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[sentSms]
Script Date: 03/05/2013 12:50:42 *****
*/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[sentSms](
[smsId] [int] IDENTITY(1,1) NOT NULL,
[message] [varchar](50) NULL,
[Number] [bigint] NULL,
[sentTime] [datetime] NULL,
CONSTRAINT [PK_sentSms] PRIMARY KEY CLUSTERED

(
[smsId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[relCarrierGeofence]
Script Date: 03/05/2013 12:
50:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[relCarrierGeofence](
[GeofenceId] [bigint] IDENTITY(1,1) NOT NULL,
[CarrierID] [bigint] NOT NULL,
[StartTime] [datetime] NOT NULL,
[EndTime] [datetime] NOT NULL,
[CalcDays] [int] NOT NULL,
[AreaName] [varchar](240) NOT NULL,
[GeoLatitude1] [float] NOT NULL,
[GeoLongitude1] [float] NOT NULL,
[GeoLatitude2] [float] NULL,
[GeoLongitude2] [float] NULL,
[GeoFenceAttribute] [int] NOT NULL,
[IsCircularGF] [bit] NULL,
[Radius] [int] NULL,
CONSTRAINT [PK_relCarrierGeofence1] PRIMARY KEY CLUSTERED
(
[GeofenceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[rawDataPointer]
Script Date: 03/05/2013 12:50:4
2 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[rawDataPointer](
[Id] [int] IDENTITY(1,1) NOT NULL,
[imei] [bigint] NOT NULL,
[time] [datetime] NOT NULL,
[latitude] [float] NULL,
[longitude] [float] NULL,
[altitude] [float] NULL,
[sat] [int] NULL,
[speed] [float] NULL,
[hVersion] [varchar](50) NULL,
[sVersion] [varchar](50) NULL,
[pVersion] [varchar](50) NULL,
[RFID] [varchar](50) NULL,

[Din1] [varchar](10) NULL,


[Din2] [varchar](10) NULL,
[Din3] [varchar](10) NULL,
[Din4] [varchar](10) NULL,
[Analog1] [float] NULL,
[Analog2] [float] NULL,
[Analog3] [float] NULL,
[Analog4] [float] NULL,
[temperature] [float] NULL,
[mileageCounter] [float] NULL,
[direction] [float] NULL,
[mcc] [int] NULL,
[mnc] [int] NULL,
[mci] [int] NULL,
[lac] [int] NULL,
[lbsLocation] [tinyint] NULL,
[addressFId] [int] NULL,
CONSTRAINT [PK_rawDataPointer] PRIMARY KEY CLUSTERED
(
[imei] ASC,
[time] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[oneWeekData]
Script Date: 03/05/2013 12:50:42 *
*****/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[oneWeekData](
[Id] [int] IDENTITY(1,1) NOT NULL,
[carrierFId] [int] NOT NULL,
[codecId] [int] NULL,
[time] [datetime] NOT NULL,
[priority] [int] NULL,
[latitude] [float] NULL,
[longitude] [float] NULL,
[altitude] [float] NULL,
[sat] [int] NULL,
[speed] [float] NULL,
[angle] [int] NULL,
[Din1] [int] NULL,
[Din2] [int] NULL,
[Din3] [int] NULL,
[Din4] [int] NULL,
[Analog1] [float] NULL,
[Analog2] [float] NULL,
[Analog3] [float] NULL,
[Analog4] [float] NULL,
[GSMSignalStrength] [int] NULL,
[CurrentProfile] [int] NULL,
[GPSSpeed] [float] NULL,
[BatteryVoltage] [float] NULL,
[BatteryCurrent] [float] NULL,
[PcbTemp] [float] NULL,
[FuelCounter] [bigint] NULL,

[MovementSensor] [int] NULL,


[Dallas0] [float] NULL,
[Dallas1] [float] NULL,
[Dallas2] [float] NULL,
[IButton] [bigint] NULL,
[Odometer] [int] NULL,
[addressFId] [int] NULL,
[lbsLocation] [tinyint] NULL,
CONSTRAINT [PK_weekDayData] PRIMARY KEY CLUSTERED
(
[carrierFId] ASC,
[time] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[prevDayData]
Script Date: 03/05/2013 12:50:42 *
*****/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[prevDayData](
[Id] [int] IDENTITY(1,1) NOT NULL,
[carrierFId] [int] NOT NULL,
[codecId] [int] NULL,
[time] [datetime] NOT NULL,
[priority] [int] NULL,
[latitude] [float] NULL,
[longitude] [float] NULL,
[altitude] [float] NULL,
[sat] [int] NULL,
[speed] [float] NULL,
[angle] [int] NULL,
[Din1] [int] NULL,
[Din2] [int] NULL,
[Din3] [int] NULL,
[Din4] [int] NULL,
[Analog1] [float] NULL,
[Analog2] [float] NULL,
[Analog3] [float] NULL,
[Analog4] [float] NULL,
[GSMSignalStrength] [int] NULL,
[CurrentProfile] [int] NULL,
[GPSSpeed] [float] NULL,
[BatteryVoltage] [float] NULL,
[BatteryCurrent] [float] NULL,
[PcbTemp] [float] NULL,
[FuelCounter] [bigint] NULL,
[MovementSensor] [int] NULL,
[Dallas0] [float] NULL,
[Dallas1] [float] NULL,
[Dallas2] [float] NULL,
[IButton] [bigint] NULL,
[Odometer] [int] NULL,
[addressFId] [int] NULL,
[lbsLocation] [tinyint] NULL,
CONSTRAINT [PK_prevDayData] PRIMARY KEY CLUSTERED
(
[carrierFId] ASC,

[time] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[overSpeeding]
Script Date: 03/05/2013 12:50:42
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[overSpeeding](
[Id] [int] IDENTITY(1,1) NOT NULL,
[carrierFId] [int] NOT NULL,
[time] [datetime] NOT NULL,
[latitude] [float] NULL,
[longitude] [float] NULL,
[speed] [float] NULL,
CONSTRAINT [PK_overSpeeding] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[organisation]
Script Date: 03/05/2013 12:50:42
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[organisation](
[orgId] [int] IDENTITY(1,1) NOT NULL,
[orgName] [varchar](50) NOT NULL,
[companyFId] [int] NULL,
[orgContact] [bigint] NULL,
[orgEmail] [varchar](50) NULL,
[orgAddr] [varchar](50) NULL,
[createdOn] [datetime] NULL,
[expiryOn] [datetime] NOT NULL,
[logo] [nvarchar](max) NULL,
[website] [varchar](50) NULL,
[orgLogo] [varchar](100) NULL,
[SmsNumberLimits] [int] NULL,
[carrierLimit] [int] NULL,
[UserId] [int] NULL,
[Status] [char](1) NULL,
[orgLimit] [int] NULL,
CONSTRAINT [PK_organisation] PRIMARY KEY CLUSTERED
(
[orgId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[DeviceDetails]
Script Date: 03/05/2013 12:50:41

******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DeviceDetails](
[DeviceID] [int] IDENTITY(1,1) NOT NULL,
[DeviceIMEI] [bigint] NOT NULL,
[DeviceSerial] [nvarchar](255) NULL,
[DeviceName] [nvarchar](255) NULL,
[userFid] [int] NOT NULL,
CONSTRAINT [PK_DeviceDetails] PRIMARY KEY CLUSTERED
(
[DeviceID] ASC,
[DeviceIMEI] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[smsAlerts]
Script Date: 03/05/2013 12:50:42 ***
***/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[smsAlerts](
[smsId] [int] IDENTITY(1,1) NOT NULL,
[alertFid] [int] NOT NULL,
[alertTime] [datetime] NULL,
[carrierFid] [int] NULL,
[lat] [float] NULL,
[long] [float] NULL,
[priority] [int] NULL,
[timeout] [int] NULL,
[smsType] [int] NULL,
[fenceName] [varchar](400) NULL,
CONSTRAINT [PK_smsAlerts] PRIMARY KEY CLUSTERED
(
[smsId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'0 means other
alerts 1 means geofence alerts' , @level0type=N'SCHEMA',@level0name=N'dbo', @lev
el1type=N'TABLE',@level1name=N'smsAlerts', @level2type=N'COLUMN',@level2name=N's
msType'
GO
/****** Object: Table [dbo].[fleet]
Script Date: 03/05/2013 12:50:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[fleet](

[fleetID] [int] IDENTITY(1,1) NOT NULL,


[fleetName] [varchar](100) NOT NULL,
[orgFId] [int] NOT NULL,
[description] [varchar](150) NULL,
[fleetArea] [varchar](100) NULL,
CONSTRAINT [PK_fleet] PRIMARY KEY CLUSTERED
(
[fleetName] ASC,
[orgFId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[carrier]
Script Date: 03/05/2013 12:50:41 *****
*/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[carrier](
[carrierID] [int] IDENTITY(1,1) NOT NULL,
[carrierName] [varchar](50) NOT NULL,
[deviceImei] [varchar](150) NOT NULL,
[carrierTypeFId] [int] NULL,
[orgFId] [int] NULL,
[companyFId] [int] NULL,
[zoneFId] [int] NULL,
[fleetFid] [int] NULL,
[gsmNumber] [bigint] NOT NULL,
[Status] [char](1) NULL,
[overSpeedThreshold] [float] NULL,
[din2Logic] [tinyint] NULL,
[digIgnitionUsed] [tinyint] NULL,
[VehicleChassisNumber] [varchar](50) NULL,
[VehicleRunning] [int] NULL,
[VehicleFuelCapacity] [int] NULL,
[VehicleAverage] [int] NULL,
[VehicleTyreCount] [int] NULL,
[LastServicingDate] [datetime] NULL,
[LastServicingDetails] [nvarchar](255) NULL,
[apnName] [varchar](50) NULL,
[apnUserName] [varchar](50) NULL,
[apnPassword] [varchar](50) NULL,
[deviceType] [varchar](50) NULL,
[simServiceType] [varchar](50) NULL,
[CalibrationType] [tinyint] NULL,
[UserId] [int] NULL,
[Move] [nvarchar](max) NULL,
[NonMove] [nvarchar](max) NULL,
[Overspeed] [nvarchar](max) NULL,
[LBS] [nvarchar](max) NULL,
[Personal] [nvarchar](max) NULL,
[Stop] [nvarchar](max) NULL,
CONSTRAINT [PK_VehicleDetails] PRIMARY KEY CLUSTERED
(
[carrierID] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL


LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'0 means negati
ve logic 1 means positive logic' , @level0type=N'SCHEMA',@level0name=N'dbo', @le
vel1type=N'TABLE',@level1name=N'carrier', @level2type=N'COLUMN',@level2name=N'di
n2Logic'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'1 if Din1 conn
ected else 0' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@
level1name=N'carrier', @level2type=N'COLUMN',@level2name=N'digIgnitionUsed'
GO
/****** Object: Table [dbo].[credentials]
Script Date: 03/05/2013 12:50:41 *
*****/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[credentials](
[accountId] [int] IDENTITY(1,1) NOT NULL,
[uName] [varchar](50) NOT NULL,
[uPass] [varchar](50) NOT NULL,
[roleFId] [int] NULL,
[createdOn] [datetime] NULL,
[expiryOn] [datetime] NULL,
[companyFId] [int] NULL,
[orgFId] [int] NULL,
CONSTRAINT [PK_credentials] PRIMARY KEY CLUSTERED
(
[uName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[alertNumbers]
Script Date: 03/05/2013 12:50:41
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[alertNumbers](
[contactId] [int] IDENTITY(1,1) NOT NULL,
[contactNumber] [bigint] NOT NULL,
[carrierFId] [int] NOT NULL,
[alertFId] [int] NOT NULL,
[active] [tinyint] NULL,
CONSTRAINT [PK_Contacts] PRIMARY KEY CLUSTERED
(
[contactNumber] ASC,
[carrierFId] ASC,
[alertFId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Geofencing]
Script Date: 03/05/2013 12:50:42 **
****/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Geofencing](
[fenceId] [int] IDENTITY(1,1) NOT NULL,
[fenceName] [nvarchar](255) NOT NULL,
[fenceType] [int] NULL,
[centerLat] [float] NULL,
[centerLong] [float] NULL,
[fenceRadius] [float] NULL,
[carrierFId] [int] NULL,
[alertStartTime] [datetime] NULL,
[alertStopTime] [datetime] NULL,
[lastStatus] [int] NULL,
CONSTRAINT [PK_Geofencing] PRIMARY KEY CLUSTERED
(
[fenceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'0 means out of
the geofence 1 means inside the geofence' , @level0type=N'SCHEMA',@level0name=N
'dbo', @level1type=N'TABLE',@level1name=N'Geofencing', @level2type=N'COLUMN',@le
vel2name=N'lastStatus'
GO
/****** Object: Table [dbo].[geofenceAlert]
Script Date: 03/05/2013 12:50:42
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[geofenceAlert](
[alertID] [int] IDENTITY(1,1) NOT NULL,
[alertMessage] [varchar](150) NULL,
[alertTime] [datetime] NULL,
[carrierFid] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[EmailContacts]
Script Date: 03/05/2013 12:50:42
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[EmailContacts](
[EmailId] [int] IDENTITY(1,1) NOT NULL,
[EmailAddr] [nvarchar](50) NOT NULL,
[carrierFId] [int] NULL,
CONSTRAINT [PK_EmailContacts] PRIMARY KEY CLUSTERED
(

[EmailId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Ignition_OnOff]
Script Date: 03/05/2013 12:50:4
2 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Ignition_OnOff](
[Id] [int] IDENTITY(1,1) NOT NULL,
[carrierFId] [int] NOT NULL,
[time] [datetime] NOT NULL,
[latitude] [float] NULL,
[longitude] [float] NULL,
[speed] [float] NULL,
[Din1] [int] NULL,
CONSTRAINT [PK_Ignition_OnOff] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[lastLog]
Script Date: 03/05/2013 12:50:42 *****
*/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[lastLog](
[Id] [int] IDENTITY(1,1) NOT NULL,
[carrierFId] [int] NOT NULL,
[codecId] [int] NULL,
[time] [datetime] NOT NULL,
[priority] [int] NULL,
[latitude] [float] NULL,
[longitude] [float] NULL,
[altitude] [float] NULL,
[sat] [int] NULL,
[speed] [float] NULL,
[angle] [int] NULL,
[Din1] [int] NULL,
[Din2] [int] NULL,
[Din3] [int] NULL,
[Din4] [int] NULL,
[Analog1] [float] NULL,
[Analog2] [float] NULL,
[Analog3] [float] NULL,
[Analog4] [float] NULL,
[GSMSignalStrength] [int] NULL,
[CurrentProfile] [int] NULL,
[GPSSpeed] [float] NULL,
[BatteryVoltage] [float] NULL,
[BatteryCurrent] [float] NULL,
[PcbTemp] [float] NULL,
[FuelCounter] [bigint] NULL,
[MovementSensor] [int] NULL,

[Dallas0] [float] NULL,


[Dallas1] [float] NULL,
[Dallas2] [float] NULL,
[IButton] [bigint] NULL,
[Odometer] [int] NULL,
[addressFId] [int] NULL,
[lbsLocation] [tinyint] NULL,
CONSTRAINT [PK_lastLog] PRIMARY KEY CLUSTERED
(
[carrierFId] ASC,
[time] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[geoStatus]
Script Date: 03/05/2013 12:50:42 ***
***/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[geoStatus](
[rptId] [int] IDENTITY(1,1) NOT NULL,
[geoFId] [int] NULL,
[time] [datetime] NULL,
[lat] [float] NULL,
[long] [float] NULL,
[geoStat] [int] NULL,
[insertTime] [datetime] NULL,
CONSTRAINT [PK_geoStatus] PRIMARY KEY CLUSTERED
(
[rptId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[geoPoints]
Script Date: 03/05/2013 12:50:42 ***
***/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[geoPoints](
[pointId] [int] IDENTITY(1,1) NOT NULL,
[geoFId] [int] NULL,
[geoSerial] [int] NULL,
[lat] [float] NULL,
[long] [float] NULL,
[width] [float] NULL,
CONSTRAINT [PK_geoPoints] PRIMARY KEY CLUSTERED
(
[pointId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[emailAlerts]
Script Date: 03/05/2013 12:50:42 *
*****/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[emailAlerts](
[emailId] [int] IDENTITY(1,1) NOT NULL,
[emailFId] [int] NOT NULL,
[alertFId] [int] NOT NULL,
[alertTime] [date] NULL,
[carrierFid] [int] NULL,
CONSTRAINT [PK_emailAlerts] PRIMARY KEY CLUSTERED
(
[emailId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[mts]
Script Date: 03/05/2013 12:50:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[mts](
[Id] [int] IDENTITY(1,1) NOT NULL,
[carrierFId] [int] NOT NULL,
[codecId] [int] NULL,
[time] [datetime] NOT NULL,
[priority] [int] NULL,
[latitude] [float] NULL,
[longitude] [float] NULL,
[altitude] [float] NULL,
[sat] [int] NULL,
[speed] [float] NULL,
[angle] [int] NULL,
[Din1] [int] NULL,
[Din2] [int] NULL,
[Din3] [int] NULL,
[Din4] [int] NULL,
[Analog1] [float] NULL,
[Analog2] [float] NULL,
[Analog3] [float] NULL,
[Analog4] [float] NULL,
[GSMSignalStrength] [int] NULL,
[CurrentProfile] [int] NULL,
[GPSSpeed] [float] NULL,
[BatteryVoltage] [float] NULL,
[BatteryCurrent] [float] NULL,
[PcbTemp] [float] NULL,
[FuelCounter] [bigint] NULL,
[MovementSensor] [int] NULL,
[Dallas0] [float] NULL,
[Dallas1] [float] NULL,
[Dallas2] [float] NULL,
[IButton] [bigint] NULL,
[Odometer] [int] NULL,
[addressFId] [int] NULL,
[lbsLocation] [tinyint] NULL,
CONSTRAINT [PK_mts] PRIMARY KEY NONCLUSTERED
(
[carrierFId] ASC,
[time] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL

LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]


) ON [PRIMARY]
GO
/****** Object: Table [dbo].[rawDataAndroid]
Script Date: 03/05/2013 12:50:4
2 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[rawDataAndroid](
[Id] [int] IDENTITY(1,1) NOT NULL,
[imei] [varchar](150) NOT NULL,
[latitude] [float] NULL,
[longitude] [float] NULL,
[time] [datetime] NOT NULL,
[mcc] [int] NULL,
[mnc] [int] NULL,
[lac] [int] NULL,
[cellId] [int] NULL,
[battery] [float] NULL,
[speed] [float] NULL,
[lbsLocation] [tinyint] NULL,
CONSTRAINT [PK_rawDataAndroid] PRIMARY KEY CLUSTERED
(
[imei] ASC,
[time] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[rawData]
Script Date: 03/05/2013 12:50:42 *****
*/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[rawData](
[Id] [int] IDENTITY(1,1) NOT NULL,
[imei] [bigint] NOT NULL,
[codecId] [int] NULL,
[time] [datetime] NOT NULL,
[priority] [int] NULL,
[latitude] [float] NULL,
[longitude] [float] NULL,
[altitude] [float] NULL,
[sat] [int] NULL,
[speed] [float] NULL,
[angle] [int] NULL,
[Din1] [int] NULL,
[Din2] [int] NULL,
[Din3] [int] NULL,
[Din4] [int] NULL,
[Analog1] [float] NULL,
[Analog2] [float] NULL,
[Analog3] [float] NULL,
[Analog4] [float] NULL,

[GSMSignalStrength] [int] NULL,


[CurrentProfile] [int] NULL,
[GPSSpeed] [float] NULL,
[BatteryVoltage] [float] NULL,
[BatteryCurrent] [float] NULL,
[PcbTemp] [float] NULL,
[FuelCounter] [bigint] NULL,
[MovementSensor] [int] NULL,
[Dallas0] [float] NULL,
[Dallas1] [float] NULL,
[Dallas2] [float] NULL,
[Ibutton] [bigint] NULL,
[Odometer] [int] NULL,
[usbConnection] [tinyint] NULL,
[cellId] [bigint] NULL,
[operatorCode] [bigint] NULL,
[hdop] [float] NULL,
[vdop] [float] NULL,
[pdop] [float] NULL,
[operateCode] [bigint] NULL,
[addressFId] [int] NULL,
CONSTRAINT [PK_rawData] PRIMARY KEY CLUSTERED
(
[imei] ASC,
[time] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'only for gh de
vice' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1na
me=N'rawData', @level2type=N'COLUMN',@level2name=N'usbConnection'
GO
/****** Object: Table [dbo].[rawDataK10]
Script Date: 03/05/2013 12:50:42 **
****/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[rawDataK10](
[ID] [int] IDENTITY(1,1) NOT NULL,
[imei] [bigint] NOT NULL,
[time] [datetime] NOT NULL,
[latitude] [float] NULL,
[longitude] [float] NULL,
[speed] [float] NULL,
[angle] [float] NULL,
[power] [tinyint] NULL,
[signal] [tinyint] NULL,
[receivedAt] [datetime] NULL,
[gpsAvail] [tinyint] NULL,
CONSTRAINT [PK_rawDataK10] PRIMARY KEY CLUSTERED
(
[imei] ASC,
[time] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[rawDataGS503]
Script Date: 03/05/2013 12:50:42

******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[rawDataGS503](
[Id] [int] IDENTITY(1,1) NOT NULL,
[imei] [bigint] NOT NULL,
[time] [datetime] NOT NULL,
[latitude] [float] NULL,
[longitude] [float] NULL,
[angle] [float] NULL,
[lbsLocation] [tinyint] NULL,
[sat] [int] NULL,
[speed] [float] NULL,
[GSMSignalStrength] [int] NULL,
[BatteryVoltage] [float] NULL,
[deviceStatus] [int] NULL,
[addressFId] [int] NULL,
[mcc] [float] NULL,
[mnc] [float] NULL,
[mci] [int] NULL,
[lac] [int] NULL,
[mrssi] [int] NULL,
[mci1] [int] NULL,
[mci2] [int] NULL,
[mci3] [int] NULL,
[mci4] [int] NULL,
[mci5] [int] NULL,
[mci6] [int] NULL,
[lac1] [int] NULL,
[lac2] [int] NULL,
[lac3] [int] NULL,
[lac4] [int] NULL,
[lac5] [int] NULL,
[lac6] [int] NULL,
[mrssi1] [int] NULL,
[mrssi2] [int] NULL,
[mrssi3] [int] NULL,
[mrssi4] [int] NULL,
[mrssi5] [int] NULL,
[mrssi6] [int] NULL,
CONSTRAINT [PK_rawDataGS503] PRIMARY KEY CLUSTERED
(
[imei] ASC,
[time] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[rawDataGoSafe]
Script Date: 03/05/2013 12:50:42
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[rawDataGoSafe](
[Id] [int] IDENTITY(1,1) NOT NULL,

[imei] [bigint] NOT NULL,


[time] [datetime] NOT NULL,
[priority] [int] NULL,
[latitude] [float] NULL,
[latDir] [varchar](50) NULL,
[longitude] [float] NULL,
[lonDir] [varchar](50) NULL,
[altitude] [float] NULL,
[speed] [float] NULL,
[speedDir] [varchar](50) NULL,
[byte1] [varchar](50) NULL,
[byte2] [varchar](50) NULL,
[byte3] [varchar](50) NULL,
[byte4] [varchar](50) NULL,
[mileage] [varchar](50) NULL,
[userAlarm] [varchar](50) NULL,
[ua1] [tinyint] NULL,
[ua2] [tinyint] NULL,
[ua3] [tinyint] NULL,
[ua4] [tinyint] NULL,
[ua5] [tinyint] NULL,
[ua6] [tinyint] NULL,
[ua7] [tinyint] NULL,
[ua8] [tinyint] NULL,
[Analog1] [float] NULL,
[Analog2] [float] NULL,
[Analog3] [float] NULL,
[Analog4] [float] NULL,
[GSMSignalStrength] [int] NULL,
[CurrentProfile] [int] NULL,
[BatteryVoltage] [float] NULL,
[BatteryCurrent] [float] NULL,
[PcbTemp] [float] NULL,
[FuelCounter] [bigint] NULL,
[MovementSensor] [int] NULL,
[Dallas2] [float] NULL,
[Ibutton] [bigint] NULL,
[Odometer] [int] NULL,
CONSTRAINT [PK_rawDataGoSafe] PRIMARY KEY CLUSTERED
(
[imei] ASC,
[time] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, AL
LOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Default [DF_carrier_digIgnitionUsed]
Script Date: 03/05/2013
12:50:41 ******/
ALTER TABLE [dbo].[carrier] ADD CONSTRAINT [DF_carrier_digIgnitionUsed] DEFAUL
T ((0)) FOR [digIgnitionUsed]
GO
/****** Object: Default [DF_Geofencing_lastStatus]
Script Date: 03/05/2013 1
2:50:42 ******/
ALTER TABLE [dbo].[Geofencing] ADD CONSTRAINT [DF_Geofencing_lastStatus] DEFAU
LT ((0)) FOR [lastStatus]
GO
/****** Object: Default [DF_organisation_SmsNumberLimits]
Script Date: 03/05
/2013 12:50:42 ******/

ALTER TABLE [dbo].[organisation] ADD CONSTRAINT [DF_organisation_SmsNumberLimit


s] DEFAULT ((2)) FOR [SmsNumberLimits]
GO
/****** Object: Default [DF_organisation_orgLimit]
Script Date: 03/05/2013 1
2:50:42 ******/
ALTER TABLE [dbo].[organisation] ADD CONSTRAINT [DF_organisation_orgLimit] DEF
AULT ((1)) FOR [orgLimit]
GO
/****** Object: Default [DF_rawDataGS503_lbsLocation]
Script Date: 03/05/201
3 12:50:42 ******/
ALTER TABLE [dbo].[rawDataGS503] ADD CONSTRAINT [DF_rawDataGS503_lbsLocation]
DEFAULT ((0)) FOR [lbsLocation]
GO
/****** Object: Default [DF_users_CompanyLimit]
Script Date: 03/05/2013 12:5
0:42 ******/
ALTER TABLE [dbo].[users] ADD CONSTRAINT [DF_users_CompanyLimit] DEFAULT ((1))
FOR [CompanyLimit]
GO
/****** Object: ForeignKey [FK_alertNumbers_alerts]
Script Date: 03/05/2013
12:50:41 ******/
ALTER TABLE [dbo].[alertNumbers] WITH CHECK ADD CONSTRAINT [FK_alertNumbers_al
erts] FOREIGN KEY([alertFId])
REFERENCES [dbo].[alerts] ([alertId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[alertNumbers] CHECK CONSTRAINT [FK_alertNumbers_alerts]
GO
/****** Object: ForeignKey [FK_alertNumbers_carrier]
Script Date: 03/05/2013
12:50:41 ******/
ALTER TABLE [dbo].[alertNumbers] WITH CHECK ADD CONSTRAINT [FK_alertNumbers_ca
rrier] FOREIGN KEY([carrierFId])
REFERENCES [dbo].[carrier] ([carrierID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[alertNumbers] CHECK CONSTRAINT [FK_alertNumbers_carrier]
GO
/****** Object: ForeignKey [FK_carrier_Company]
Script Date: 03/05/2013 12:5
0:41 ******/
ALTER TABLE [dbo].[carrier] WITH CHECK ADD CONSTRAINT [FK_carrier_Company] FOR
EIGN KEY([companyFId])
REFERENCES [dbo].[Company] ([companyID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[carrier] CHECK CONSTRAINT [FK_carrier_Company]
GO
/****** Object: ForeignKey [FK_carrier_organisation]
Script Date: 03/05/2013
12:50:41 ******/
ALTER TABLE [dbo].[carrier] WITH CHECK ADD CONSTRAINT [FK_carrier_organisation
] FOREIGN KEY([orgFId])
REFERENCES [dbo].[organisation] ([orgId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[carrier] CHECK CONSTRAINT [FK_carrier_organisation]
GO
/****** Object: ForeignKey [FK_carrier_timeZone]
Script Date: 03/05/2013 12:
50:41 ******/

ALTER TABLE [dbo].[carrier] WITH CHECK ADD CONSTRAINT [FK_carrier_timeZone] FO


REIGN KEY([zoneFId])
REFERENCES [dbo].[timeZone] ([zoneId])
GO
ALTER TABLE [dbo].[carrier] CHECK CONSTRAINT [FK_carrier_timeZone]
GO
/****** Object: ForeignKey [FK_carrier_trackType]
Script Date: 03/05/2013 12
:50:41 ******/
ALTER TABLE [dbo].[carrier] WITH CHECK ADD CONSTRAINT [FK_carrier_trackType] F
OREIGN KEY([carrierTypeFId])
REFERENCES [dbo].[trackType] ([trackTypeID])
GO
ALTER TABLE [dbo].[carrier] CHECK CONSTRAINT [FK_carrier_trackType]
GO
/****** Object: ForeignKey [FK_credentials_Company]
Script Date: 03/05/2013
12:50:41 ******/
ALTER TABLE [dbo].[credentials] WITH CHECK ADD CONSTRAINT [FK_credentials_Comp
any] FOREIGN KEY([companyFId])
REFERENCES [dbo].[Company] ([companyID])
GO
ALTER TABLE [dbo].[credentials] CHECK CONSTRAINT [FK_credentials_Company]
GO
/****** Object: ForeignKey [FK_credentials_organisation]
Script Date: 03/05/
2013 12:50:41 ******/
ALTER TABLE [dbo].[credentials] WITH CHECK ADD CONSTRAINT [FK_credentials_orga
nisation] FOREIGN KEY([orgFId])
REFERENCES [dbo].[organisation] ([orgId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[credentials] CHECK CONSTRAINT [FK_credentials_organisation]
GO
/****** Object: ForeignKey [FK_credentials_userRoles]
Script Date: 03/05/201
3 12:50:41 ******/
ALTER TABLE [dbo].[credentials] WITH CHECK ADD CONSTRAINT [FK_credentials_user
Roles] FOREIGN KEY([roleFId])
REFERENCES [dbo].[userRoles] ([roleId])
GO
ALTER TABLE [dbo].[credentials] CHECK CONSTRAINT [FK_credentials_userRoles]
GO
/****** Object: ForeignKey [FK_DeviceDetails_UserDetails]
Script Date: 03/05
/2013 12:50:41 ******/
ALTER TABLE [dbo].[DeviceDetails] WITH CHECK ADD CONSTRAINT [FK_DeviceDetails_
UserDetails] FOREIGN KEY([userFid])
REFERENCES [dbo].[UserDetails] ([UserID])
GO
ALTER TABLE [dbo].[DeviceDetails] CHECK CONSTRAINT [FK_DeviceDetails_UserDetails
]
GO
/****** Object: ForeignKey [FK_emailAlerts_alerts]
Script Date: 03/05/2013 1
2:50:42 ******/
ALTER TABLE [dbo].[emailAlerts] WITH CHECK ADD CONSTRAINT [FK_emailAlerts_aler
ts] FOREIGN KEY([alertFId])
REFERENCES [dbo].[alerts] ([alertId])
GO
ALTER TABLE [dbo].[emailAlerts] CHECK CONSTRAINT [FK_emailAlerts_alerts]
GO
/****** Object: ForeignKey [FK_emailAlerts_EmailContacts]
Script Date: 03/05
/2013 12:50:42 ******/
ALTER TABLE [dbo].[emailAlerts] WITH CHECK ADD CONSTRAINT [FK_emailAlerts_Emai

lContacts] FOREIGN KEY([emailFId])


REFERENCES [dbo].[EmailContacts] ([EmailId])
GO
ALTER TABLE [dbo].[emailAlerts] CHECK CONSTRAINT [FK_emailAlerts_EmailContacts]
GO
/****** Object: ForeignKey [FK_EmailContacts_carrier]
Script Date: 03/05/201
3 12:50:42 ******/
ALTER TABLE [dbo].[EmailContacts] WITH CHECK ADD CONSTRAINT [FK_EmailContacts_
carrier] FOREIGN KEY([carrierFId])
REFERENCES [dbo].[carrier] ([carrierID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[EmailContacts] CHECK CONSTRAINT [FK_EmailContacts_carrier]
GO
/****** Object: ForeignKey [FK_fleet_organisation]
Script Date: 03/05/2013 1
2:50:42 ******/
ALTER TABLE [dbo].[fleet] WITH CHECK ADD CONSTRAINT [FK_fleet_organisation] FO
REIGN KEY([orgFId])
REFERENCES [dbo].[organisation] ([orgId])
GO
ALTER TABLE [dbo].[fleet] CHECK CONSTRAINT [FK_fleet_organisation]
GO
/****** Object: ForeignKey [FK_Geofencing_carrier]
Script Date: 03/05/2013 1
2:50:42 ******/
ALTER TABLE [dbo].[Geofencing] WITH CHECK ADD CONSTRAINT [FK_Geofencing_carrie
r] FOREIGN KEY([carrierFId])
REFERENCES [dbo].[carrier] ([carrierID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Geofencing] CHECK CONSTRAINT [FK_Geofencing_carrier]
GO
/****** Object: ForeignKey [FK_geoPoints_Geofencing]
Script Date: 03/05/2013
12:50:42 ******/
ALTER TABLE [dbo].[geoPoints] WITH CHECK ADD CONSTRAINT [FK_geoPoints_Geofenci
ng] FOREIGN KEY([geoFId])
REFERENCES [dbo].[Geofencing] ([fenceId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[geoPoints] CHECK CONSTRAINT [FK_geoPoints_Geofencing]
GO
/****** Object: ForeignKey [FK_geoStatus_Geofencing]
Script Date: 03/05/2013
12:50:42 ******/
ALTER TABLE [dbo].[geoStatus] WITH CHECK ADD CONSTRAINT [FK_geoStatus_Geofenci
ng] FOREIGN KEY([geoFId])
REFERENCES [dbo].[Geofencing] ([fenceId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[geoStatus] CHECK CONSTRAINT [FK_geoStatus_Geofencing]
GO
/****** Object: ForeignKey [FK_Ignition_OnOff_carrier]
Script Date: 03/05/20
13 12:50:42 ******/
ALTER TABLE [dbo].[Ignition_OnOff] WITH CHECK ADD CONSTRAINT [FK_Ignition_OnOf
f_carrier] FOREIGN KEY([carrierFId])
REFERENCES [dbo].[carrier] ([carrierID])
ON UPDATE CASCADE
ON DELETE CASCADE

GO
ALTER TABLE [dbo].[Ignition_OnOff] CHECK CONSTRAINT [FK_Ignition_OnOff_carrier]
GO
/****** Object: ForeignKey [FK_lastLog_carrier]
Script Date: 03/05/2013 12:5
0:42 ******/
ALTER TABLE [dbo].[lastLog] WITH CHECK ADD CONSTRAINT [FK_lastLog_carrier] FOR
EIGN KEY([carrierFId])
REFERENCES [dbo].[carrier] ([carrierID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[lastLog] CHECK CONSTRAINT [FK_lastLog_carrier]
GO
/****** Object: ForeignKey [FK_organisation_Company]
Script Date: 03/05/2013
12:50:42 ******/
ALTER TABLE [dbo].[organisation] WITH CHECK ADD CONSTRAINT [FK_organisation_Co
mpany] FOREIGN KEY([companyFId])
REFERENCES [dbo].[Company] ([companyID])
GO
ALTER TABLE [dbo].[organisation] CHECK CONSTRAINT [FK_organisation_Company]
GO
/****** Object: ForeignKey [FK_smsAlerts_alerts]
Script Date: 03/05/2013 12:
50:42 ******/
ALTER TABLE [dbo].[smsAlerts] WITH CHECK ADD CONSTRAINT [FK_smsAlerts_alerts]
FOREIGN KEY([alertFid])
REFERENCES [dbo].[alerts] ([alertId])
GO
ALTER TABLE [dbo].[smsAlerts] CHECK CONSTRAINT [FK_smsAlerts_alerts]
GO