USE [master]
GO
/****** Object:  Database [Arcopol]    Script Date: 02/20/2012 09:49:20 ******/
CREATE DATABASE [Arcopol] ON  PRIMARY 
( NAME = N'Arcopol', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\Arcopol.mdf' , SIZE = 3328KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'Arcopol_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\Arcopol_log.LDF' , SIZE = 576KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
ALTER DATABASE [Arcopol] SET COMPATIBILITY_LEVEL = 100
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [Arcopol].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [Arcopol] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [Arcopol] SET ANSI_NULLS OFF
GO
ALTER DATABASE [Arcopol] SET ANSI_PADDING OFF
GO
ALTER DATABASE [Arcopol] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [Arcopol] SET ARITHABORT OFF
GO
ALTER DATABASE [Arcopol] SET AUTO_CLOSE ON
GO
ALTER DATABASE [Arcopol] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [Arcopol] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [Arcopol] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [Arcopol] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [Arcopol] SET CURSOR_DEFAULT  GLOBAL
GO
ALTER DATABASE [Arcopol] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [Arcopol] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [Arcopol] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [Arcopol] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [Arcopol] SET  ENABLE_BROKER
GO
ALTER DATABASE [Arcopol] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [Arcopol] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [Arcopol] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [Arcopol] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [Arcopol] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [Arcopol] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [Arcopol] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [Arcopol] SET  READ_WRITE
GO
ALTER DATABASE [Arcopol] SET RECOVERY SIMPLE
GO
ALTER DATABASE [Arcopol] SET  MULTI_USER
GO
ALTER DATABASE [Arcopol] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [Arcopol] SET DB_CHAINING OFF
GO
USE [Arcopol]
GO

CREATE TABLE [dbo].[GeoLocationRisk](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[DateTime] [datetime] NULL,
	[RiskValue] [float] NULL,
	[RiskValueCollisionShipToShip] [float] NULL,
	[RiskValuePortCollision] [float] NULL,
	[RiskValueGrounding] [float] NULL,
	[RiskValueDriftGrounding] [float] NULL,
	[RiskValueFoundering] [float] NULL,
	[RiskValueGroundingDuringNavigation] [float] NULL,
	[Fcd] [float] NULL,
	[GEOLOCATIONRISKLIST_ID] [bigint] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO


CREATE TABLE [dbo].[GeoLocationIndexes](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[DateTime] [datetime] NULL,
	[AmbientalIndex] [float] NULL,
	[SocioEconomicIndex] [float] NULL,
	[GEOLOCATIONINDEXESLIST_ID] [bigint] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GeoLocation]    Script Date: 02/20/2012 09:49:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[GeoLocation](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NULL,
	[Description] [nvarchar](255) NULL,
	[WKB] [varbinary](max) NULL,
	[Active] [bit] NULL,
	[CurrentGeoLocationIndex] [bigint] NULL,
	[CurrentGeoLocationRisk] [bigint] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[VesselRisk]    Script Date: 02/20/2012 09:49:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VesselRisk](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[VesselPositionType] [int] NULL,
	[DateTimeOfRisk] [datetime] NULL,
	[VesselRiskValue] [float] NULL,
	[RiskValueCollisionShipToShip] [float] NULL,
	[RiskValuePortCollision] [float] NULL,
	[RiskValueGrounding] [float] NULL,
	[RiskValueFoundering] [float] NULL,
	[RiskValueDriftGrounding] [float] NULL,
	[RiskValueGroundingDuringNavigation] [float] NULL,
	[FrequencyIndexCollisionShipToShip] [float] NULL,
	[FrequencyIndexPortCollision] [float] NULL,
	[FrequencyIndexGrounding] [float] NULL,
	[FrequencyIndexFoundering] [float] NULL,
	[FrequencyIndexDriftGrounding] [float] NULL,
	[FrequencyIndexGroundingDuringNavigation] [float] NULL,
	[SeverityIndexCollisionShipToShip] [float] NULL,
	[SeverityIndexPortCollision] [float] NULL,
	[SeverityIndexGrounding] [float] NULL,
	[SeverityIndexFoundering] [float] NULL,
	[SeverityIndexDriftGrounding] [float] NULL,
	[SeverityIndexGroundingDuringNavigation] [float] NULL,
	[VEHICLEPOSITION_ID] [bigint] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VesselGeoLocationRisk]    Script Date: 02/20/2012 09:49:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VesselGeoLocationRisk](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[DateTimeOfRisk] [datetime] NULL,
	[GeoRiskCollisionShipToShip] [float] NULL,
	[GeoRiskPortCollision] [float] NULL,
	[GeoRiskGrounding] [float] NULL,
	[GeoRiskFoundering] [float] NULL,
	[GeoRiskDriftGrounding] [float] NULL,
	[GeoRiskGroundingDuringNavigation] [float] NULL,
	[GeoRisk] [float] NULL,
	[Fcd] [float] NULL,
	[GEOLOCATIONVESSELRISKLIST_ID] [bigint] NOT NULL,
	[VEHICLEPOSITIONRISK_ID] [bigint] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Vessel]    Script Date: 02/20/2012 09:49:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Vessel](
	[ID] [bigint] NOT NULL,
	[Name] [nvarchar](255) NULL,
	[VesselType] [int] NULL,
	[Year] [int] NULL,
	[Flag] [nvarchar](255) NULL,
	[IMO] [nvarchar](255) NULL,
	[MMSI] [nvarchar](255) NULL,
	[CallSign] [nvarchar](255) NULL,
	[Length] [float] NULL,
	[Breadth] [float] NULL,
	[DeadWeight] [float] NULL,
	[SpeedMax] [float] NULL,
	[SpeedAverage] [float] NULL,
	[HullType] [int] NULL,
	[Photo] [varbinary](max) NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[VehicleVoyage]    Script Date: 02/20/2012 09:49:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VehicleVoyage](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[UpdateDateTime] [datetime] NULL,
	[Destination] [nvarchar](255) NULL,
	[ETA] [datetime] NULL,
	[Draught] [float] NULL,
	[VEHICLEVOYAGELIST_ID] [bigint] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[VehiclePosition]    Script Date: 02/20/2012 09:49:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VehiclePosition](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[UpdateDateTime] [datetime] NULL,
	[Area] [nvarchar](255) NULL,
	[Speed] [float] NULL,
	[Longitude] [float] NULL,
	[Latitude] [float] NULL,
	[Course] [float] NULL,
	[VehicleStatusType] [int] NULL,
	[ETA] [datetime] NULL,
	[VesselInThreeMileZone] [bit] NULL,
	[VEHICLEPOSITIONLIST_ID] [bigint] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Vehicle]    Script Date: 02/20/2012 09:49:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Vehicle](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[Description] [nvarchar](3999) NULL,
	[UniqueIdentification] [nvarchar](255) NULL,
	[DateCreated] [datetime] NULL,
	[DateUpdated] [datetime] NULL,
	[LastPositionReceived] [bigint] NULL,
	[LastVoyageReceived] [bigint] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Parameter]    Script Date: 02/20/2012 09:49:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Parameter](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NULL,
	[DisplayName] [nvarchar](255) NULL,
	[Units] [nvarchar](255) NULL,
	[AllowChangeName] [bit] NULL,
	[NumericDisplayFormat] [nvarchar](255) NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY],
UNIQUE NONCLUSTERED 
(
	[DisplayName] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY],
UNIQUE NONCLUSTERED 
(
	[Name] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  View [dbo].[NHSP_GEOMETRY_COLUMNS]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[NHSP_GEOMETRY_COLUMNS] AS
                SELECT
                F_TABLE_CATALOG = cols.TABLE_CATALOG,
                F_TABLE_SCHEMA = cols.TABLE_SCHEMA,
                F_TABLE_NAME = cols.TABLE_NAME,
                F_GEOMETRY_COLUMN = cols.COLUMN_NAME,
                SRID = COALESCE(srid_checks.SRID, 0),
                TYPE = COALESCE(type_checks.TYPE, 'GEOMETRY'),
                COORD_DIMENSION = 2 -- TO-DO
                FROM INFORMATION_SCHEMA.COLUMNS cols
                LEFT JOIN (
	                SELECT
	                 TABLE_NAME = t.name
	                ,TABLE_SCHEMA = sc.name
	                ,COLUMN_NAME = c.name
	                ,SRID = CAST(
		                SUBSTRING(
			                ck.definition, 
			                CHARINDEX('].[STSrid]=(', ck.definition) + 12, 
			                LEN(ck.definition) - CHARINDEX('].[STSrid]=(', ck.definition) - 13
		                )
		                AS INTEGER
	                )
	                FROM sys.check_constraints ck, sys.schemas sc, sys.columns c, sys.tables t
	                WHERE ck.schema_id = sc.schema_id
	                AND ck.parent_column_id = c.column_id
	                AND ck.parent_object_id = c.object_id
	                AND CHARINDEX('].[STSrid]=(', ck.definition) <> 0
	                AND c.object_id = t.object_id
                ) as srid_checks
                ON cols.TABLE_SCHEMA = srid_checks.TABLE_SCHEMA
                AND cols.TABLE_NAME = srid_checks.TABLE_NAME
                AND cols.COLUMN_NAME = srid_checks.COLUMN_NAME
                LEFT JOIN (
	                SELECT
	                 TABLE_NAME = t.name
	                ,TABLE_SCHEMA = sc.name
	                ,COLUMN_NAME = c.name
	                ,TYPE = UPPER(
		                SUBSTRING(
			                ck.definition, 
			                CHARINDEX('].[STGeometryType]()=''', ck.definition) + 22, 
			                LEN(ck.definition) - CHARINDEX('].[STGeometryType]()=''', ck.definition) - 23
		                )
	                )
	                FROM sys.check_constraints ck, sys.schemas sc, sys.columns c, sys.tables t
	                WHERE ck.schema_id = sc.schema_id
	                AND ck.parent_column_id = c.column_id
	                AND ck.parent_object_id = c.object_id
	                AND CHARINDEX('].[STGeometryType]()=''', ck.definition) <> 0
	                AND c.object_id = t.object_id
                ) as type_checks
                ON cols.TABLE_SCHEMA = type_checks.TABLE_SCHEMA
                AND cols.TABLE_NAME = type_checks.TABLE_NAME
                AND cols.COLUMN_NAME = type_checks.COLUMN_NAME
                WHERE DATA_TYPE IN ('geometry')
GO
/****** Object:  Table [dbo].[MonitoringStation]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[MonitoringStation](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Longitude] [float] NULL,
	[Latitude] [float] NULL,
	[StationType] [int] NOT NULL,
	[Image] [varbinary](max) NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY],
UNIQUE NONCLUSTERED 
(
	[Name] ASC,
	[StationType] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[ImportedFile]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ImportedFile](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[FullFileName] [nvarchar](255) NULL,
	[ImportedDate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HistoryRecentEvent]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HistoryRecentEvent](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[Date] [datetime] NULL,
	[Description] [nvarchar](3999) NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[FTPConnectionInfo]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[FTPConnectionInfo](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[FTPHost] [nvarchar](255) NULL,
	[Username] [nvarchar](255) NULL,
	[Password] [nvarchar](255) NULL,
	[FTPDirectory] [nvarchar](255) NULL,
	[InsertIntoDataBase] [bit] NULL,
	[ExtractTimeSeries] [bit] NULL,
	[FTPConnectionType] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HDFFile]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HDFFile](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[Path] [nvarchar](255) NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY],
UNIQUE NONCLUSTERED 
(
	[Path] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HDFDataSet]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HDFDataSet](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[DataSetName] [nvarchar](255) NOT NULL,
	[DataSetGroup] [nvarchar](255) NOT NULL,
	[DataSetIndex] [int] NOT NULL,
	[Rank] [int] NOT NULL,
	[DataSetInstant] [datetime] NOT NULL,
	[HDFFILE_ID] [bigint] NOT NULL,
	[PARAMETER_ID] [bigint] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[GridBasedHDFFile]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GridBasedHDFFile](
	[ID] [bigint] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[DataConvertionInfo]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DataConvertionInfo](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[Executable] [nvarchar](255) NULL,
	[CommandLine] [nvarchar](255) NULL,
	[CommandFile] [nvarchar](255) NULL,
	[DataConvertionType] [int] NULL,
	[FTPCONNECTIONINFO_ID] [bigint] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ModelDomain]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ModelDomain](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NULL,
	[GridFile] [nvarchar](255) NULL,
	[GeometryFile] [nvarchar](255) NULL,
	[WorkingDirectory] [nvarchar](255) NULL,
	[StorageDirectory] [nvarchar](255) NULL,
	[NestedLevel] [int] NULL,
	[ShowOnMap] [bit] NULL,
	[ModelType] [int] NULL,
	[HindcastHours] [float] NULL,
	[ForecastHours] [float] NULL,
	[SpinUpHours] [float] NULL,
	[CronExpression] [nvarchar](255) NULL,
	[EnableScheduling] [bit] NULL,
	[IsLocalDomain] [bit] NULL,
	[FATHERDOMAIN_ID] [bigint] NULL,
	[FTPCONNECTIONINFO_ID] [bigint] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY],
UNIQUE NONCLUSTERED 
(
	[Name] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TimeSeries]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TimeSeries](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[TimeSeriesType] [int] NULL,
	[ModelDomainName] [nvarchar](255) NULL,
	[SameMonitoringStationLocation] [bit] NULL,
	[Longitude] [float] NULL,
	[Latitude] [float] NULL,
	[Depth] [float] NULL,
	[PARAMETER_ID] [bigint] NOT NULL,
	[MONITORINGSTATION_ID] [bigint] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[NetworkBasedHDFFile]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[NetworkBasedHDFFile](
	[ID] [bigint] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MovingTimeSeries]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MovingTimeSeries](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NULL,
	[Date] [datetime] NULL,
	[Description] [nvarchar](3999) NULL,
	[PARAMETER_ID] [bigint] NOT NULL,
	[MONITORINGSTATION_MTS_ID] [bigint] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TimeSeriesValue]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TimeSeriesValue](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[DateTime] [datetime] NOT NULL,
	[Value] [float] NOT NULL,
	[TIMESERIES_ID] [bigint] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[MovingTimeSeriesValue]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MovingTimeSeriesValue](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[DateTime] [datetime] NOT NULL,
	[Value] [float] NOT NULL,
	[Longitude] [float] NULL,
	[Latitude] [float] NULL,
	[Depth] [float] NULL,
	[Description] [nvarchar](3999) NULL,
	[MOVINGTIMESERIES_ID] [bigint] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[StorageTimeSeries]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[StorageTimeSeries](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[WaterStructureID] [nvarchar](255) NOT NULL,
	[MODELDOMAIN_ID] [bigint] NULL,
	[PARAMETER_ID] [bigint] NOT NULL,
	[STATION_ID] [bigint] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RestartFile]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RestartFile](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[Instant] [datetime] NULL,
	[Path] [nvarchar](255) NULL,
	[Module] [nvarchar](255) NULL,
	[MODELDOMAIN_ID] [bigint] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ImportFileFromDrive]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ImportFileFromDrive](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[Directory] [nvarchar](255) NULL,
	[FileFilter] [nvarchar](255) NULL,
	[CheckSubDirectory] [bit] NULL,
	[DeleteFileAfterImport] [bit] NULL,
	[CopyFileToStoreDirectory] [bit] NULL,
	[MoveFileToStoreDirectory] [bit] NULL,
	[StorageDirectory] [nvarchar](255) NULL,
	[SpinUpHours] [float] NULL,
	[FilterByCreationDate] [float] NULL,
	[ExtractTimeSeries] [bit] NULL,
	[MODEL_DOMAIN_ID] [bigint] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ModelRun]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ModelRun](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[ColdStart] [bit] NULL,
	[StartInstant] [datetime] NULL,
	[EndInstant] [datetime] NULL,
	[spinUpHours] [float] NULL,
	[DataPreparationError] [nvarchar](4000) NULL,
	[ModelExecutionError] [nvarchar](4000) NULL,
	[DataStorageError] [nvarchar](4000) NULL,
	[MODELDOMAIN_ID] [bigint] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BoundaryCondition]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BoundaryCondition](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[TargetFile] [nvarchar](255) NULL,
	[BcType] [int] NULL,
	[MODELDOMAIN_ID] [bigint] NULL,
	[PARAMETER_ID] [bigint] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[BoundaryConditionProvider]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BoundaryConditionProvider](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[PriorityNumber] [int] NULL,
	[Description] [nvarchar](255) NULL,
	[BOUNDARYCONDITION_ID] [bigint] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[HDFFileInModelRun]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[HDFFileInModelRun](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[MODELRUN_ID] [bigint] NULL,
	[HDFFILE_ID] [bigint] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ValueFieldProvider]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ValueFieldProvider](
	[ID] [bigint] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[PointProvider]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PointProvider](
	[ID] [bigint] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TimeSeriesProvider]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TimeSeriesProvider](
	[ID] [bigint] NOT NULL,
	[TIMESERIES_ID] [bigint] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RemainLastValueProvider]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RemainLastValueProvider](
	[ID] [bigint] NOT NULL,
	[HoursToRemain] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[RemainLastValueFieldProvider]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[RemainLastValueFieldProvider](
	[ID] [bigint] NOT NULL,
	[HoursToRemain] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ConstantValueProvider]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ConstantValueProvider](
	[ID] [bigint] NOT NULL,
	[ConstantValue] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[ConstantValueFieldProvider]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ConstantValueFieldProvider](
	[ID] [bigint] NOT NULL,
	[Value] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[FieldBoundaryCondition]    Script Date: 02/20/2012 09:49:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[FieldBoundaryCondition](
	[ID] [bigint] NOT NULL,
	[ModelDomain] [bigint] NULL,
PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  ForeignKey [FKADF4BD4D5D4BA78C]    Script Date: 02/20/2012 09:49:22 ******/
ALTER TABLE [dbo].[GeoLocationRisk]  WITH CHECK ADD  CONSTRAINT [FKADF4BD4D5D4BA78C] FOREIGN KEY([GEOLOCATIONRISKLIST_ID])
REFERENCES [dbo].[GeoLocation] ([ID])
GO
ALTER TABLE [dbo].[GeoLocationRisk] CHECK CONSTRAINT [FKADF4BD4D5D4BA78C]
GO
/****** Object:  ForeignKey [FK483E176B3C1AD24]    Script Date: 02/20/2012 09:49:22 ******/
ALTER TABLE [dbo].[GeoLocationIndexes]  WITH CHECK ADD  CONSTRAINT [FK483E176B3C1AD24] FOREIGN KEY([GEOLOCATIONINDEXESLIST_ID])
REFERENCES [dbo].[GeoLocation] ([ID])
GO
ALTER TABLE [dbo].[GeoLocationIndexes] CHECK CONSTRAINT [FK483E176B3C1AD24]
GO
/****** Object:  ForeignKey [FK74479BDE8782D637]    Script Date: 02/20/2012 09:49:22 ******/
ALTER TABLE [dbo].[GeoLocation]  WITH CHECK ADD  CONSTRAINT [FK74479BDE8782D637] FOREIGN KEY([CurrentGeoLocationRisk])
REFERENCES [dbo].[GeoLocationRisk] ([ID])
GO
ALTER TABLE [dbo].[GeoLocation] CHECK CONSTRAINT [FK74479BDE8782D637]
GO
/****** Object:  ForeignKey [FK74479BDEC0B7B5C]    Script Date: 02/20/2012 09:49:22 ******/
ALTER TABLE [dbo].[GeoLocation]  WITH CHECK ADD  CONSTRAINT [FK74479BDEC0B7B5C] FOREIGN KEY([CurrentGeoLocationIndex])
REFERENCES [dbo].[GeoLocationIndexes] ([ID])
GO
ALTER TABLE [dbo].[GeoLocation] CHECK CONSTRAINT [FK74479BDEC0B7B5C]
GO
/****** Object:  ForeignKey [FK1624254AA844C84]    Script Date: 02/20/2012 09:49:22 ******/
ALTER TABLE [dbo].[VesselRisk]  WITH CHECK ADD  CONSTRAINT [FK1624254AA844C84] FOREIGN KEY([VEHICLEPOSITION_ID])
REFERENCES [dbo].[VehiclePosition] ([ID])
GO
ALTER TABLE [dbo].[VesselRisk] CHECK CONSTRAINT [FK1624254AA844C84]
GO
/****** Object:  ForeignKey [FK2D47766634C57481]    Script Date: 02/20/2012 09:49:22 ******/
ALTER TABLE [dbo].[VesselGeoLocationRisk]  WITH CHECK ADD  CONSTRAINT [FK2D47766634C57481] FOREIGN KEY([GEOLOCATIONVESSELRISKLIST_ID])
REFERENCES [dbo].[GeoLocation] ([ID])
GO
ALTER TABLE [dbo].[VesselGeoLocationRisk] CHECK CONSTRAINT [FK2D47766634C57481]
GO
/****** Object:  ForeignKey [FK2D477666F1C7D7CA]    Script Date: 02/20/2012 09:49:22 ******/
ALTER TABLE [dbo].[VesselGeoLocationRisk]  WITH CHECK ADD  CONSTRAINT [FK2D477666F1C7D7CA] FOREIGN KEY([VEHICLEPOSITIONRISK_ID])
REFERENCES [dbo].[VehiclePosition] ([ID])
GO
ALTER TABLE [dbo].[VesselGeoLocationRisk] CHECK CONSTRAINT [FK2D477666F1C7D7CA]
GO
/****** Object:  ForeignKey [FK2EFB4D06EFB719CB]    Script Date: 02/20/2012 09:49:22 ******/
ALTER TABLE [dbo].[Vessel]  WITH CHECK ADD  CONSTRAINT [FK2EFB4D06EFB719CB] FOREIGN KEY([ID])
REFERENCES [dbo].[Vehicle] ([ID])
GO
ALTER TABLE [dbo].[Vessel] CHECK CONSTRAINT [FK2EFB4D06EFB719CB]
GO
/****** Object:  ForeignKey [FKEAEE5EDCA08682C9]    Script Date: 02/20/2012 09:49:22 ******/
ALTER TABLE [dbo].[VehicleVoyage]  WITH CHECK ADD  CONSTRAINT [FKEAEE5EDCA08682C9] FOREIGN KEY([VEHICLEVOYAGELIST_ID])
REFERENCES [dbo].[Vehicle] ([ID])
GO
ALTER TABLE [dbo].[VehicleVoyage] CHECK CONSTRAINT [FKEAEE5EDCA08682C9]
GO
/****** Object:  ForeignKey [FKE4A01A87110FB9A3]    Script Date: 02/20/2012 09:49:22 ******/
ALTER TABLE [dbo].[VehiclePosition]  WITH CHECK ADD  CONSTRAINT [FKE4A01A87110FB9A3] FOREIGN KEY([VEHICLEPOSITIONLIST_ID])
REFERENCES [dbo].[Vehicle] ([ID])
GO
ALTER TABLE [dbo].[VehiclePosition] CHECK CONSTRAINT [FKE4A01A87110FB9A3]
GO
/****** Object:  ForeignKey [FK7867CB24A6347A7E]    Script Date: 02/20/2012 09:49:22 ******/
ALTER TABLE [dbo].[Vehicle]  WITH CHECK ADD  CONSTRAINT [FK7867CB24A6347A7E] FOREIGN KEY([LastVoyageReceived])
REFERENCES [dbo].[VehicleVoyage] ([ID])
GO
ALTER TABLE [dbo].[Vehicle] CHECK CONSTRAINT [FK7867CB24A6347A7E]
GO
/****** Object:  ForeignKey [FK7867CB24CB3044E8]    Script Date: 02/20/2012 09:49:22 ******/
ALTER TABLE [dbo].[Vehicle]  WITH CHECK ADD  CONSTRAINT [FK7867CB24CB3044E8] FOREIGN KEY([LastPositionReceived])
REFERENCES [dbo].[VehiclePosition] ([ID])
GO
ALTER TABLE [dbo].[Vehicle] CHECK CONSTRAINT [FK7867CB24CB3044E8]
GO
/****** Object:  ForeignKey [FK5F7F2A858DD10590]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[HDFDataSet]  WITH CHECK ADD  CONSTRAINT [FK5F7F2A858DD10590] FOREIGN KEY([HDFFILE_ID])
REFERENCES [dbo].[HDFFile] ([ID])
GO
ALTER TABLE [dbo].[HDFDataSet] CHECK CONSTRAINT [FK5F7F2A858DD10590]
GO
/****** Object:  ForeignKey [FK5F7F2A85C1064690]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[HDFDataSet]  WITH CHECK ADD  CONSTRAINT [FK5F7F2A85C1064690] FOREIGN KEY([PARAMETER_ID])
REFERENCES [dbo].[Parameter] ([ID])
GO
ALTER TABLE [dbo].[HDFDataSet] CHECK CONSTRAINT [FK5F7F2A85C1064690]
GO
/****** Object:  ForeignKey [FK853BFC88439E43D]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[GridBasedHDFFile]  WITH CHECK ADD  CONSTRAINT [FK853BFC88439E43D] FOREIGN KEY([ID])
REFERENCES [dbo].[HDFFile] ([ID])
GO
ALTER TABLE [dbo].[GridBasedHDFFile] CHECK CONSTRAINT [FK853BFC88439E43D]
GO
/****** Object:  ForeignKey [FK158C2B64BCFF3531]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[DataConvertionInfo]  WITH CHECK ADD  CONSTRAINT [FK158C2B64BCFF3531] FOREIGN KEY([FTPCONNECTIONINFO_ID])
REFERENCES [dbo].[FTPConnectionInfo] ([ID])
GO
ALTER TABLE [dbo].[DataConvertionInfo] CHECK CONSTRAINT [FK158C2B64BCFF3531]
GO
/****** Object:  ForeignKey [FKEBF26E7927E9625E]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[ModelDomain]  WITH CHECK ADD  CONSTRAINT [FKEBF26E7927E9625E] FOREIGN KEY([FATHERDOMAIN_ID])
REFERENCES [dbo].[ModelDomain] ([ID])
GO
ALTER TABLE [dbo].[ModelDomain] CHECK CONSTRAINT [FKEBF26E7927E9625E]
GO
/****** Object:  ForeignKey [FKEBF26E79BCFF3531]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[ModelDomain]  WITH CHECK ADD  CONSTRAINT [FKEBF26E79BCFF3531] FOREIGN KEY([FTPCONNECTIONINFO_ID])
REFERENCES [dbo].[FTPConnectionInfo] ([ID])
GO
ALTER TABLE [dbo].[ModelDomain] CHECK CONSTRAINT [FKEBF26E79BCFF3531]
GO
/****** Object:  ForeignKey [FKBFCCD4FCC1064690]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[TimeSeries]  WITH CHECK ADD  CONSTRAINT [FKBFCCD4FCC1064690] FOREIGN KEY([PARAMETER_ID])
REFERENCES [dbo].[Parameter] ([ID])
GO
ALTER TABLE [dbo].[TimeSeries] CHECK CONSTRAINT [FKBFCCD4FCC1064690]
GO
/****** Object:  ForeignKey [FKBFCCD4FCCD777FEB]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[TimeSeries]  WITH CHECK ADD  CONSTRAINT [FKBFCCD4FCCD777FEB] FOREIGN KEY([MONITORINGSTATION_ID])
REFERENCES [dbo].[MonitoringStation] ([ID])
GO
ALTER TABLE [dbo].[TimeSeries] CHECK CONSTRAINT [FKBFCCD4FCCD777FEB]
GO
/****** Object:  ForeignKey [FK4CF6CD708439E43D]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[NetworkBasedHDFFile]  WITH CHECK ADD  CONSTRAINT [FK4CF6CD708439E43D] FOREIGN KEY([ID])
REFERENCES [dbo].[HDFFile] ([ID])
GO
ALTER TABLE [dbo].[NetworkBasedHDFFile] CHECK CONSTRAINT [FK4CF6CD708439E43D]
GO
/****** Object:  ForeignKey [FK65427BC530E23118]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[MovingTimeSeries]  WITH CHECK ADD  CONSTRAINT [FK65427BC530E23118] FOREIGN KEY([MONITORINGSTATION_MTS_ID])
REFERENCES [dbo].[MonitoringStation] ([ID])
GO
ALTER TABLE [dbo].[MovingTimeSeries] CHECK CONSTRAINT [FK65427BC530E23118]
GO
/****** Object:  ForeignKey [FK65427BC5C1064690]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[MovingTimeSeries]  WITH CHECK ADD  CONSTRAINT [FK65427BC5C1064690] FOREIGN KEY([PARAMETER_ID])
REFERENCES [dbo].[Parameter] ([ID])
GO
ALTER TABLE [dbo].[MovingTimeSeries] CHECK CONSTRAINT [FK65427BC5C1064690]
GO
/****** Object:  ForeignKey [FK1C8C334B7F69AED5]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[TimeSeriesValue]  WITH CHECK ADD  CONSTRAINT [FK1C8C334B7F69AED5] FOREIGN KEY([TIMESERIES_ID])
REFERENCES [dbo].[TimeSeries] ([ID])
GO
ALTER TABLE [dbo].[TimeSeriesValue] CHECK CONSTRAINT [FK1C8C334B7F69AED5]
GO
/****** Object:  ForeignKey [FK1F0B7BAAC6C536D1]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[MovingTimeSeriesValue]  WITH CHECK ADD  CONSTRAINT [FK1F0B7BAAC6C536D1] FOREIGN KEY([MOVINGTIMESERIES_ID])
REFERENCES [dbo].[MovingTimeSeries] ([ID])
GO
ALTER TABLE [dbo].[MovingTimeSeriesValue] CHECK CONSTRAINT [FK1F0B7BAAC6C536D1]
GO
/****** Object:  ForeignKey [FK2263CDD78B2B917F]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[StorageTimeSeries]  WITH CHECK ADD  CONSTRAINT [FK2263CDD78B2B917F] FOREIGN KEY([MODELDOMAIN_ID])
REFERENCES [dbo].[ModelDomain] ([ID])
GO
ALTER TABLE [dbo].[StorageTimeSeries] CHECK CONSTRAINT [FK2263CDD78B2B917F]
GO
/****** Object:  ForeignKey [FK2263CDD7BAC37DA0]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[StorageTimeSeries]  WITH CHECK ADD  CONSTRAINT [FK2263CDD7BAC37DA0] FOREIGN KEY([STATION_ID])
REFERENCES [dbo].[MonitoringStation] ([ID])
GO
ALTER TABLE [dbo].[StorageTimeSeries] CHECK CONSTRAINT [FK2263CDD7BAC37DA0]
GO
/****** Object:  ForeignKey [FK2263CDD7C1064690]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[StorageTimeSeries]  WITH CHECK ADD  CONSTRAINT [FK2263CDD7C1064690] FOREIGN KEY([PARAMETER_ID])
REFERENCES [dbo].[Parameter] ([ID])
GO
ALTER TABLE [dbo].[StorageTimeSeries] CHECK CONSTRAINT [FK2263CDD7C1064690]
GO
/****** Object:  ForeignKey [FK762096CB8B2B917F]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[RestartFile]  WITH CHECK ADD  CONSTRAINT [FK762096CB8B2B917F] FOREIGN KEY([MODELDOMAIN_ID])
REFERENCES [dbo].[ModelDomain] ([ID])
GO
ALTER TABLE [dbo].[RestartFile] CHECK CONSTRAINT [FK762096CB8B2B917F]
GO
/****** Object:  ForeignKey [FK7FC5DE4345B1687F]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[ImportFileFromDrive]  WITH CHECK ADD  CONSTRAINT [FK7FC5DE4345B1687F] FOREIGN KEY([MODEL_DOMAIN_ID])
REFERENCES [dbo].[ModelDomain] ([ID])
GO
ALTER TABLE [dbo].[ImportFileFromDrive] CHECK CONSTRAINT [FK7FC5DE4345B1687F]
GO
/****** Object:  ForeignKey [FKDC0A7E88B2B917F]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[ModelRun]  WITH CHECK ADD  CONSTRAINT [FKDC0A7E88B2B917F] FOREIGN KEY([MODELDOMAIN_ID])
REFERENCES [dbo].[ModelDomain] ([ID])
GO
ALTER TABLE [dbo].[ModelRun] CHECK CONSTRAINT [FKDC0A7E88B2B917F]
GO
/****** Object:  ForeignKey [FK5DD339DD8B2B917F]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[BoundaryCondition]  WITH CHECK ADD  CONSTRAINT [FK5DD339DD8B2B917F] FOREIGN KEY([MODELDOMAIN_ID])
REFERENCES [dbo].[ModelDomain] ([ID])
GO
ALTER TABLE [dbo].[BoundaryCondition] CHECK CONSTRAINT [FK5DD339DD8B2B917F]
GO
/****** Object:  ForeignKey [FK5DD339DDC1064690]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[BoundaryCondition]  WITH CHECK ADD  CONSTRAINT [FK5DD339DDC1064690] FOREIGN KEY([PARAMETER_ID])
REFERENCES [dbo].[Parameter] ([ID])
GO
ALTER TABLE [dbo].[BoundaryCondition] CHECK CONSTRAINT [FK5DD339DDC1064690]
GO
/****** Object:  ForeignKey [FKC741F06180FEE5BD]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[BoundaryConditionProvider]  WITH CHECK ADD  CONSTRAINT [FKC741F06180FEE5BD] FOREIGN KEY([BOUNDARYCONDITION_ID])
REFERENCES [dbo].[BoundaryCondition] ([ID])
GO
ALTER TABLE [dbo].[BoundaryConditionProvider] CHECK CONSTRAINT [FKC741F06180FEE5BD]
GO
/****** Object:  ForeignKey [FK61222888DD10590]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[HDFFileInModelRun]  WITH CHECK ADD  CONSTRAINT [FK61222888DD10590] FOREIGN KEY([HDFFILE_ID])
REFERENCES [dbo].[HDFFile] ([ID])
GO
ALTER TABLE [dbo].[HDFFileInModelRun] CHECK CONSTRAINT [FK61222888DD10590]
GO
/****** Object:  ForeignKey [FK6122288D720E758]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[HDFFileInModelRun]  WITH CHECK ADD  CONSTRAINT [FK6122288D720E758] FOREIGN KEY([MODELRUN_ID])
REFERENCES [dbo].[ModelRun] ([ID])
GO
ALTER TABLE [dbo].[HDFFileInModelRun] CHECK CONSTRAINT [FK6122288D720E758]
GO
/****** Object:  ForeignKey [FK37AD581D821A42C1]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[ValueFieldProvider]  WITH CHECK ADD  CONSTRAINT [FK37AD581D821A42C1] FOREIGN KEY([ID])
REFERENCES [dbo].[BoundaryConditionProvider] ([ID])
GO
ALTER TABLE [dbo].[ValueFieldProvider] CHECK CONSTRAINT [FK37AD581D821A42C1]
GO
/****** Object:  ForeignKey [FK62B8D2CD821A42C1]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[PointProvider]  WITH CHECK ADD  CONSTRAINT [FK62B8D2CD821A42C1] FOREIGN KEY([ID])
REFERENCES [dbo].[BoundaryConditionProvider] ([ID])
GO
ALTER TABLE [dbo].[PointProvider] CHECK CONSTRAINT [FK62B8D2CD821A42C1]
GO
/****** Object:  ForeignKey [FK44762843EC01375]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[TimeSeriesProvider]  WITH CHECK ADD  CONSTRAINT [FK44762843EC01375] FOREIGN KEY([ID])
REFERENCES [dbo].[PointProvider] ([ID])
GO
ALTER TABLE [dbo].[TimeSeriesProvider] CHECK CONSTRAINT [FK44762843EC01375]
GO
/****** Object:  ForeignKey [FK44762847F69AED5]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[TimeSeriesProvider]  WITH CHECK ADD  CONSTRAINT [FK44762847F69AED5] FOREIGN KEY([TIMESERIES_ID])
REFERENCES [dbo].[TimeSeries] ([ID])
GO
ALTER TABLE [dbo].[TimeSeriesProvider] CHECK CONSTRAINT [FK44762847F69AED5]
GO
/****** Object:  ForeignKey [FK7781925B3EC01375]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[RemainLastValueProvider]  WITH CHECK ADD  CONSTRAINT [FK7781925B3EC01375] FOREIGN KEY([ID])
REFERENCES [dbo].[PointProvider] ([ID])
GO
ALTER TABLE [dbo].[RemainLastValueProvider] CHECK CONSTRAINT [FK7781925B3EC01375]
GO
/****** Object:  ForeignKey [FKECA9F14F39D3E95C]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[RemainLastValueFieldProvider]  WITH CHECK ADD  CONSTRAINT [FKECA9F14F39D3E95C] FOREIGN KEY([ID])
REFERENCES [dbo].[ValueFieldProvider] ([ID])
GO
ALTER TABLE [dbo].[RemainLastValueFieldProvider] CHECK CONSTRAINT [FKECA9F14F39D3E95C]
GO
/****** Object:  ForeignKey [FKBA4305DB3EC01375]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[ConstantValueProvider]  WITH CHECK ADD  CONSTRAINT [FKBA4305DB3EC01375] FOREIGN KEY([ID])
REFERENCES [dbo].[PointProvider] ([ID])
GO
ALTER TABLE [dbo].[ConstantValueProvider] CHECK CONSTRAINT [FKBA4305DB3EC01375]
GO
/****** Object:  ForeignKey [FK933DDABE39D3E95C]    Script Date: 02/20/2012 09:49:23 ******/
ALTER TABLE [dbo].[ConstantValueFieldProvider]  WITH CHECK ADD  CONSTRAINT [FK933DDABE39D3E95C] FOREIGN KEY([ID])
REFERENCES [dbo].[ValueFieldProvider] ([ID])
GO
ALTER TABLE [dbo].[ConstantValueFieldProvider] CHECK CONSTRAINT [FK933DDABE39D3E95C]
GO