74 lines
1.9 KiB
Transact-SQL
74 lines
1.9 KiB
Transact-SQL
USE [Mobile_Registration]
|
|
GO
|
|
|
|
/****** Object: Table [dbo].[Hosts_Guids] Script Date: 01/02/2013 00:53:26 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
SET ANSI_PADDING ON
|
|
GO
|
|
|
|
-- WILL ONLY WORK LIKE THIS ON SQL 2008
|
|
|
|
CREATE TABLE [dbo].[Hosts_Guids](
|
|
[ID] [bigint] IDENTITY(1,1) NOT NULL,
|
|
[SystemApiKey] [nchar](22) NOT NULL,
|
|
[Host_Guid] [uniqueidentifier] NOT NULL,
|
|
[Internal_IP] [nchar](15) NOT NULL,
|
|
[External_IP] [nchar](15) NOT NULL,
|
|
[Port] [int] NOT NULL,
|
|
[Practice_Name] [nvarchar](50) NOT NULL,
|
|
[UpdatedToVersion] [varchar](15) NULL,
|
|
[LastServerUpdate] [datetime] NULL,
|
|
[IsInternal] [bit] NULL,
|
|
CONSTRAINT [Hosts_Guids.Primary Key - ID] 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],
|
|
CONSTRAINT [IX_SystemApiKeys] UNIQUE NONCLUSTERED
|
|
(
|
|
[SystemApiKey] ASC
|
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY]
|
|
) ON [PRIMARY]
|
|
|
|
GO
|
|
|
|
--
|
|
-- INDEXES
|
|
--
|
|
|
|
-- Now tie System Api Keys and Host Guids together
|
|
CREATE UNIQUE NONCLUSTERED INDEX [IX_SystemApiKeys - HostGuid] ON [dbo].[Hosts_Guids]
|
|
(
|
|
[SystemApiKey] ASC,
|
|
[Host_Guid] ASC
|
|
) ON [PRIMARY];
|
|
|
|
-- Create an Index on Host Guids
|
|
CREATE NONCLUSTERED INDEX [IX_HostGUIDs] ON [dbo].[Hosts_Guids]
|
|
(
|
|
[Host_Guid] ASC
|
|
) ON [PRIMARY];
|
|
|
|
-- Create an Index on Mobile Api Versions (for later lookup)
|
|
CREATE NONCLUSTERED INDEX [IX_ApiVersions] ON [dbo].[Hosts_Guids]
|
|
(
|
|
[UpdatedToVersion] DESC
|
|
) ON [PRIMARY];
|
|
|
|
-- Create an Index on last IP Update (for seeing who doesn't use it)
|
|
CREATE NONCLUSTERED INDEX [IX_IPUpade] ON [dbo].[Hosts_Guids]
|
|
(
|
|
[LastServerUpdate] ASC
|
|
) ON [PRIMARY];
|
|
|
|
SET ANSI_PADDING OFF
|
|
GO
|
|
|
|
|
|
|
|
|