Created
August 19, 2011 16:23
-
-
Save srkirkland/1157248 to your computer and use it in GitHub Desktop.
SQL script for generating pre purchasing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE [PrePurchasing] | |
GO | |
/****** Object: Table [dbo].[UsersXOrganizations] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[UsersXOrganizations]( | |
[UserId] [varchar](10) NOT NULL, | |
[OrganizationId] [char](4) NOT NULL, | |
CONSTRAINT [PK_UsersXOrganizations] PRIMARY KEY CLUSTERED | |
( | |
[UserId] ASC, | |
[OrganizationId] 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 ON | |
GO | |
/****** Object: Table [dbo].[Users] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[Users]( | |
[Id] [varchar](10) NOT NULL, | |
[FirstName] [varchar](50) NOT NULL, | |
[LastName] [varchar](50) NOT NULL, | |
[Email] [varchar](50) NULL, | |
[IsActive] [bit] NOT NULL, | |
CONSTRAINT [PK_Users_1] PRIMARY KEY NONCLUSTERED | |
( | |
[Id] ASC | |
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY] | |
) ON [PRIMARY] | |
GO | |
SET ANSI_PADDING ON | |
GO | |
/****** Object: Table [dbo].[States] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[States]( | |
[Id] [char](2) NOT NULL, | |
[Name] [varchar](50) NOT NULL, | |
CONSTRAINT [PK_States] 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 ON | |
GO | |
/****** Object: Table [dbo].[ShippingTypes] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[ShippingTypes]( | |
[Id] [char](2) NOT NULL, | |
[Name] [varchar](50) NOT NULL, | |
[Warning] [varchar](max) NULL, | |
CONSTRAINT [PK_ShippingTypes] 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 ON | |
GO | |
/****** Object: Table [dbo].[Roles] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[Roles]( | |
[Id] [char](2) NOT NULL, | |
[Name] [varchar](50) NOT NULL, | |
CONSTRAINT [PK_RoleTypes_1] PRIMARY KEY NONCLUSTERED | |
( | |
[Id] ASC | |
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY] | |
) ON [PRIMARY] | |
GO | |
SET ANSI_PADDING ON | |
GO | |
/****** Object: Table [dbo].[Permissions] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[Permissions]( | |
[RoleId] [char](2) NOT NULL, | |
[UserId] [varchar](10) NOT NULL, | |
CONSTRAINT [PK_Permissions] PRIMARY KEY CLUSTERED | |
( | |
[RoleId] ASC, | |
[UserId] 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 ON | |
GO | |
/****** Object: Table [dbo].[OrderTypes] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[OrderTypes]( | |
[Id] [char](3) NOT NULL, | |
[Name] [varchar](50) NOT NULL, | |
CONSTRAINT [PK_OrderTypes] 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 ON | |
GO | |
/****** Object: Table [dbo].[Audits] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[Audits]( | |
[ID] [uniqueidentifier] NOT NULL, | |
[ObjectName] [varchar](50) NOT NULL, | |
[ObjectId] [varchar](50) NULL, | |
[AuditAction] [char](1) NOT NULL, | |
[Username] [nvarchar](256) NOT NULL, | |
[AuditDate] [datetime] NOT NULL, | |
CONSTRAINT [PK_Audit] 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 ON | |
GO | |
/****** Object: Table [dbo].[ApprovalTypes] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[ApprovalTypes]( | |
[Id] [char](2) NOT NULL, | |
[Name] [varchar](50) NOT NULL, | |
CONSTRAINT [PK_ApprovalType_1] PRIMARY KEY NONCLUSTERED | |
( | |
[Id] ASC | |
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY] | |
) ON [PRIMARY] | |
GO | |
SET ANSI_PADDING ON | |
GO | |
/****** Object: Table [dbo].[Workgroups] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[Workgroups]( | |
[Id] [int] IDENTITY(1,1) NOT NULL, | |
[Name] [varchar](50) NOT NULL, | |
[IsActive] [bit] NOT NULL, | |
CONSTRAINT [PK_Workgroups_1] PRIMARY KEY NONCLUSTERED | |
( | |
[Id] ASC | |
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY] | |
) ON [PRIMARY] | |
GO | |
SET ANSI_PADDING ON | |
GO | |
/****** Object: Table [dbo].[vOrganizations] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[vOrganizations]( | |
[Id] [char](4) NOT NULL, | |
[Name] [varchar](50) NOT NULL, | |
[TypeCode] [char](1) NOT NULL, | |
[TypeName] [varchar](50) NOT NULL, | |
[ParentId] [char](4) NULL, | |
[IsActive] [bit] NOT NULL, | |
CONSTRAINT [PK_vOrganizations_1] PRIMARY KEY NONCLUSTERED | |
( | |
[Id] ASC | |
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY] | |
) ON [PRIMARY] | |
GO | |
SET ANSI_PADDING ON | |
GO | |
/****** Object: Table [dbo].[vVendors] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[vVendors]( | |
[Id] [char](10) NOT NULL, | |
[Name] [varchar](40) NOT NULL, | |
[OwnershipCode] [varchar](2) NULL, | |
[BusinessTypeCode] [varchar](2) NULL, | |
CONSTRAINT [PK_vVendors] 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 ON | |
GO | |
/****** Object: Table [dbo].[WorkgroupVendors] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[WorkgroupVendors]( | |
[Id] [int] IDENTITY(1,1) NOT NULL, | |
[WorkgroupId] [int] NOT NULL, | |
[VendorId] [char](10) NOT NULL, | |
[VendorAddressId] [uniqueidentifier] NOT NULL, | |
[Name] [varchar](40) NOT NULL, | |
[Line1] [varchar](40) NOT NULL, | |
[Line2] [varchar](40) NULL, | |
[Line3] [varchar](40) NULL, | |
[City] [varchar](40) NOT NULL, | |
[State] [char](2) NOT NULL, | |
[Zip] [varchar](11) NOT NULL, | |
[CountryCode] [varchar](2) NULL, | |
CONSTRAINT [PK_WorkgroupVendors] 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 ON | |
GO | |
/****** Object: Table [dbo].[WorkgroupsXOrganizations] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[WorkgroupsXOrganizations]( | |
[WorkgroupId] [int] NOT NULL, | |
[OrganizationId] [char](4) NOT NULL, | |
CONSTRAINT [PK_WorkgroupsXOrganizations] PRIMARY KEY CLUSTERED | |
( | |
[WorkgroupId] ASC, | |
[OrganizationId] 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 ON | |
GO | |
/****** Object: Table [dbo].[vVendorAddresses] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[vVendorAddresses]( | |
[Id] [uniqueidentifier] NOT NULL, | |
[VendorId] [char](10) NOT NULL, | |
[Name] [varchar](40) NOT NULL, | |
[Line1] [varchar](40) NOT NULL, | |
[Line2] [varchar](40) NULL, | |
[Line3] [varchar](40) NULL, | |
[City] [varchar](40) NOT NULL, | |
[State] [char](2) NOT NULL, | |
[Zip] [varchar](11) NOT NULL, | |
[CountryCode] [varchar](2) NULL, | |
CONSTRAINT [PK_vVendorAddresses] 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 ON | |
GO | |
/****** Object: Table [dbo].[vAccounts] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[vAccounts]( | |
[Id] [varchar](10) NOT NULL, | |
[Name] [varchar](50) NOT NULL, | |
[IsActive] [bit] NOT NULL, | |
[AccountManager] [varchar](30) NOT NULL, | |
[PrincipalInvestigator] [varchar](30) NULL, | |
[OrganizationId] [char](4) NOT NULL, | |
CONSTRAINT [PK_vAccounts_1] PRIMARY KEY NONCLUSTERED | |
( | |
[Id] ASC | |
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY] | |
) ON [PRIMARY] | |
GO | |
SET ANSI_PADDING ON | |
GO | |
/****** Object: Table [dbo].[WorkgroupPermissions] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[WorkgroupPermissions]( | |
[Id] [int] IDENTITY(1,1) NOT NULL, | |
[WorkgroupId] [int] NOT NULL, | |
[UserId] [varchar](10) NOT NULL, | |
[RoleTypeId] [char](2) NOT NULL, | |
CONSTRAINT [PK_WorkgroupUsers_1] PRIMARY KEY NONCLUSTERED | |
( | |
[Id] ASC | |
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY] | |
) ON [PRIMARY] | |
GO | |
SET ANSI_PADDING ON | |
GO | |
/****** Object: Table [dbo].[WorkgroupAddresses] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[WorkgroupAddresses]( | |
[Id] [int] IDENTITY(1,1) NOT NULL, | |
[Name] [varchar](50) NOT NULL, | |
[Building] [varchar](50) NULL, | |
[Room] [varchar](50) NULL, | |
[Address] [varchar](100) NOT NULL, | |
[City] [varchar](100) NOT NULL, | |
[StateId] [char](2) NOT NULL, | |
[Zip] [varchar](10) NOT NULL, | |
[Phone] [varchar](15) NULL, | |
[WorkgroupId] [int] NOT NULL, | |
CONSTRAINT [PK_WorkgroupAddresses] 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 ON | |
GO | |
/****** Object: Table [dbo].[Approvals] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[Approvals]( | |
[Id] [int] IDENTITY(1,1) NOT NULL, | |
[Level] [int] NOT NULL, | |
[UserId] [varchar](10) NULL, | |
[Approved] [bit] NULL, | |
[ApprovalTypeId] [char](2) NOT NULL, | |
CONSTRAINT [PK_Approvals_1] PRIMARY KEY NONCLUSTERED | |
( | |
[Id] ASC | |
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY] | |
) ON [PRIMARY] | |
GO | |
SET ANSI_PADDING ON | |
GO | |
/****** Object: Table [dbo].[ConditionalApproval] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[ConditionalApproval]( | |
[Id] [int] IDENTITY(1,1) NOT NULL, | |
[Question] [varchar](100) NOT NULL, | |
[ParentId] [int] NULL, | |
[UserId] [varchar](10) NOT NULL, | |
[WorkgroupId] [int] NOT NULL, | |
CONSTRAINT [PK_ConditionalApproval_1] PRIMARY KEY NONCLUSTERED | |
( | |
[Id] ASC | |
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY] | |
) ON [PRIMARY] | |
GO | |
SET ANSI_PADDING ON | |
GO | |
/****** Object: Table [dbo].[AutoApprovals] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[AutoApprovals]( | |
[Id] [int] IDENTITY(1,1) NOT NULL, | |
[TargetUserId] [varchar](10) NULL, | |
[AccountId] [varchar](10) NULL, | |
[MaxAmount] [money] NOT NULL, | |
[LessThan] [bit] NOT NULL, | |
[Equal] [bit] NOT NULL, | |
[IsActive] [bit] NOT NULL, | |
[UserId] [varchar](10) NOT NULL, | |
CONSTRAINT [PK_AutoApprovals] 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 ON | |
GO | |
/****** Object: Table [dbo].[Orders] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[Orders]( | |
[Id] [int] IDENTITY(1,1) NOT NULL, | |
[OrderTypeId] [char](3) NOT NULL, | |
[VendorId] [int] NOT NULL, | |
[AddressId] [int] NOT NULL, | |
[ShippingTypeId] [char](2) NULL, | |
[DateNeeded] [datetime2](7) NULL, | |
[AllowBackorder] [bit] NOT NULL, | |
[EstimatedTax] [float] NULL, | |
[WorkgroupId] [int] NOT NULL, | |
[PONumber] [varchar](50) NULL, | |
[LastCompletedApproval] [int] NULL, | |
CONSTRAINT [PK_Orders_1] PRIMARY KEY NONCLUSTERED | |
( | |
[Id] ASC | |
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY] | |
) ON [PRIMARY] | |
GO | |
SET ANSI_PADDING ON | |
GO | |
/****** Object: Table [dbo].[OrderComments] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[OrderComments]( | |
[Id] [int] IDENTITY(1,1) NOT NULL, | |
[Text] [varchar](max) NOT NULL, | |
[DateCreated] [datetime] NOT NULL, | |
[UserId] [varchar](10) NOT NULL, | |
[OrderId] [int] NOT NULL, | |
CONSTRAINT [PK_OrderComments] 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 ON | |
GO | |
/****** Object: Table [dbo].[LineItems] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[LineItems]( | |
[Id] [int] IDENTITY(1,1) NOT NULL, | |
[Quantity] [int] NOT NULL, | |
[CatalogNumber] [varchar](25) NOT NULL, | |
[Description] [varchar](max) NULL, | |
[Unit] [varchar](25) NULL, | |
[UnitPrice] [money] NOT NULL, | |
[Url] [varchar](200) NULL, | |
[Notes] [varchar](max) NULL, | |
[OrderId] [int] NOT NULL, | |
CONSTRAINT [PK_LineItems_1] PRIMARY KEY NONCLUSTERED | |
( | |
[Id] ASC | |
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY] | |
) ON [PRIMARY] | |
GO | |
SET ANSI_PADDING ON | |
GO | |
/****** Object: Table [dbo].[Attachments] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[Attachments]( | |
[Id] [int] IDENTITY(1,1) NOT NULL, | |
[Filename] [varchar](100) NOT NULL, | |
[ContentType] [varchar](200) NOT NULL, | |
[Contents] [varbinary](max) NOT NULL, | |
[OrderId] [int] NOT NULL, | |
[DateCreated] [datetime] NOT NULL, | |
[UserId] [varchar](10) NOT NULL, | |
CONSTRAINT [PK_Attachments] 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 ON | |
GO | |
/****** Object: Table [dbo].[OrderTracking] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[OrderTracking]( | |
[Id] [int] IDENTITY(1,1) NOT NULL, | |
[Description] [varchar](max) NOT NULL, | |
[OrderId] [int] NOT NULL, | |
[DateCreated] [datetime2](7) NOT NULL, | |
[UserId] [varchar](10) NOT NULL, | |
CONSTRAINT [PK_OrderTracking_1] PRIMARY KEY NONCLUSTERED | |
( | |
[Id] ASC | |
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY] | |
) ON [PRIMARY] | |
GO | |
SET ANSI_PADDING ON | |
GO | |
/****** Object: Table [dbo].[WorkgroupAccounts] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[WorkgroupAccounts]( | |
[Id] [int] IDENTITY(1,1) NOT NULL, | |
[AccountId] [varchar](10) NOT NULL, | |
[WorkgroupId] [int] NOT NULL, | |
CONSTRAINT [PK_WorkgroupAccounts] 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 ON | |
GO | |
/****** Object: Table [dbo].[WorkgroupAccountPermissions] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[WorkgroupAccountPermissions]( | |
[Id] [int] IDENTITY(1,1) NOT NULL, | |
[UserId] [varchar](10) NOT NULL, | |
[RoleId] [char](2) NOT NULL, | |
[WorkgroupAccountId] [int] NOT NULL, | |
CONSTRAINT [PK_WorkgroupAccountRoles_1] PRIMARY KEY NONCLUSTERED | |
( | |
[Id] ASC | |
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY] | |
) ON [PRIMARY] | |
GO | |
SET ANSI_PADDING ON | |
GO | |
/****** Object: Table [dbo].[Splits] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
SET ANSI_PADDING ON | |
GO | |
CREATE TABLE [dbo].[Splits]( | |
[Id] [int] IDENTITY(1,1) NOT NULL, | |
[OrderId] [int] NULL, | |
[LineItemId] [int] NULL, | |
[Amount] [money] NOT NULL, | |
[AccountId] [varchar](10) NOT NULL, | |
CONSTRAINT [PK_Splits_1] PRIMARY KEY NONCLUSTERED | |
( | |
[Id] ASC | |
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY] | |
) ON [PRIMARY] | |
GO | |
SET ANSI_PADDING ON | |
GO | |
/****** Object: Table [dbo].[ApprovalsXSplits] Script Date: 08/19/2011 09:22:47 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
CREATE TABLE [dbo].[ApprovalsXSplits]( | |
[ApprovalId] [int] NOT NULL, | |
[SplitId] [int] NOT NULL, | |
CONSTRAINT [PK_ApprovalsXSplits_1] PRIMARY KEY NONCLUSTERED | |
( | |
[ApprovalId] ASC, | |
[SplitId] ASC | |
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = OFF, ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY] | |
) ON [PRIMARY] | |
GO | |
/****** Object: Default [DF_Attachments_DateCreated] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[Attachments] ADD CONSTRAINT [DF_Attachments_DateCreated] DEFAULT (getdate()) FOR [DateCreated] | |
GO | |
/****** Object: Default [DF_AutoApprovals_LessThan] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[AutoApprovals] ADD CONSTRAINT [DF_AutoApprovals_LessThan] DEFAULT ((0)) FOR [LessThan] | |
GO | |
/****** Object: Default [DF_AutoApprovals_Equal] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[AutoApprovals] ADD CONSTRAINT [DF_AutoApprovals_Equal] DEFAULT ((0)) FOR [Equal] | |
GO | |
/****** Object: Default [DF_AutoApprovals_IsActive] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[AutoApprovals] ADD CONSTRAINT [DF_AutoApprovals_IsActive] DEFAULT ((0)) FOR [IsActive] | |
GO | |
/****** Object: Default [DF_OrderComments_DateCreated] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[OrderComments] ADD CONSTRAINT [DF_OrderComments_DateCreated] DEFAULT (getdate()) FOR [DateCreated] | |
GO | |
/****** Object: Default [DF__OrderTrac__DateC__24927208] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[OrderTracking] ADD DEFAULT (getdate()) FOR [DateCreated] | |
GO | |
/****** Object: Default [DF_Users_IsActive] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[Users] ADD CONSTRAINT [DF_Users_IsActive] DEFAULT ((1)) FOR [IsActive] | |
GO | |
/****** Object: Default [DF__vAccounts__IsAct__22AA2996] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[vAccounts] ADD CONSTRAINT [DF__vAccounts__IsAct__22AA2996] DEFAULT ((0)) FOR [IsActive] | |
GO | |
/****** Object: Default [DF_vVendorAddresses_Id] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[vVendorAddresses] ADD CONSTRAINT [DF_vVendorAddresses_Id] DEFAULT (newid()) FOR [Id] | |
GO | |
/****** Object: Default [DF__Workgroup__IsAct__239E4DCF] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[Workgroups] ADD CONSTRAINT [DF__Workgroup__IsAct__239E4DCF] DEFAULT ((1)) FOR [IsActive] | |
GO | |
/****** Object: ForeignKey [FK_Approvals_ApprovalTypes] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[Approvals] WITH CHECK ADD CONSTRAINT [FK_Approvals_ApprovalTypes] FOREIGN KEY([ApprovalTypeId]) | |
REFERENCES [dbo].[ApprovalTypes] ([Id]) | |
GO | |
ALTER TABLE [dbo].[Approvals] CHECK CONSTRAINT [FK_Approvals_ApprovalTypes] | |
GO | |
/****** Object: ForeignKey [FK_ApprovalsXSplits_Approvals] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[ApprovalsXSplits] WITH CHECK ADD CONSTRAINT [FK_ApprovalsXSplits_Approvals] FOREIGN KEY([ApprovalId]) | |
REFERENCES [dbo].[Approvals] ([Id]) | |
GO | |
ALTER TABLE [dbo].[ApprovalsXSplits] CHECK CONSTRAINT [FK_ApprovalsXSplits_Approvals] | |
GO | |
/****** Object: ForeignKey [FK_ApprovalsXSplits_Splits] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[ApprovalsXSplits] WITH CHECK ADD CONSTRAINT [FK_ApprovalsXSplits_Splits] FOREIGN KEY([SplitId]) | |
REFERENCES [dbo].[Splits] ([Id]) | |
GO | |
ALTER TABLE [dbo].[ApprovalsXSplits] CHECK CONSTRAINT [FK_ApprovalsXSplits_Splits] | |
GO | |
/****** Object: ForeignKey [FK_Attachments_Orders] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[Attachments] WITH CHECK ADD CONSTRAINT [FK_Attachments_Orders] FOREIGN KEY([OrderId]) | |
REFERENCES [dbo].[Orders] ([Id]) | |
GO | |
ALTER TABLE [dbo].[Attachments] CHECK CONSTRAINT [FK_Attachments_Orders] | |
GO | |
/****** Object: ForeignKey [FK_Attachments_Users] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[Attachments] WITH CHECK ADD CONSTRAINT [FK_Attachments_Users] FOREIGN KEY([UserId]) | |
REFERENCES [dbo].[Users] ([Id]) | |
GO | |
ALTER TABLE [dbo].[Attachments] CHECK CONSTRAINT [FK_Attachments_Users] | |
GO | |
/****** Object: ForeignKey [FK_AutoApprovals_Users] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[AutoApprovals] WITH CHECK ADD CONSTRAINT [FK_AutoApprovals_Users] FOREIGN KEY([UserId]) | |
REFERENCES [dbo].[Users] ([Id]) | |
GO | |
ALTER TABLE [dbo].[AutoApprovals] CHECK CONSTRAINT [FK_AutoApprovals_Users] | |
GO | |
/****** Object: ForeignKey [FK_AutoApprovals_Users1] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[AutoApprovals] WITH CHECK ADD CONSTRAINT [FK_AutoApprovals_Users1] FOREIGN KEY([TargetUserId]) | |
REFERENCES [dbo].[Users] ([Id]) | |
GO | |
ALTER TABLE [dbo].[AutoApprovals] CHECK CONSTRAINT [FK_AutoApprovals_Users1] | |
GO | |
/****** Object: ForeignKey [FK_ConditionalApproval_ConditionalApproval] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[ConditionalApproval] WITH CHECK ADD CONSTRAINT [FK_ConditionalApproval_ConditionalApproval] FOREIGN KEY([ParentId]) | |
REFERENCES [dbo].[ConditionalApproval] ([Id]) | |
GO | |
ALTER TABLE [dbo].[ConditionalApproval] CHECK CONSTRAINT [FK_ConditionalApproval_ConditionalApproval] | |
GO | |
/****** Object: ForeignKey [FK_ConditionalApproval_Workgroups] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[ConditionalApproval] WITH CHECK ADD CONSTRAINT [FK_ConditionalApproval_Workgroups] FOREIGN KEY([WorkgroupId]) | |
REFERENCES [dbo].[Workgroups] ([Id]) | |
GO | |
ALTER TABLE [dbo].[ConditionalApproval] CHECK CONSTRAINT [FK_ConditionalApproval_Workgroups] | |
GO | |
/****** Object: ForeignKey [FK_LineItems_Orders] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[LineItems] WITH CHECK ADD CONSTRAINT [FK_LineItems_Orders] FOREIGN KEY([OrderId]) | |
REFERENCES [dbo].[Orders] ([Id]) | |
GO | |
ALTER TABLE [dbo].[LineItems] CHECK CONSTRAINT [FK_LineItems_Orders] | |
GO | |
/****** Object: ForeignKey [FK_OrderComments_Orders] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[OrderComments] WITH CHECK ADD CONSTRAINT [FK_OrderComments_Orders] FOREIGN KEY([OrderId]) | |
REFERENCES [dbo].[Orders] ([Id]) | |
GO | |
ALTER TABLE [dbo].[OrderComments] CHECK CONSTRAINT [FK_OrderComments_Orders] | |
GO | |
/****** Object: ForeignKey [FK_OrderComments_Users] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[OrderComments] WITH CHECK ADD CONSTRAINT [FK_OrderComments_Users] FOREIGN KEY([UserId]) | |
REFERENCES [dbo].[Users] ([Id]) | |
GO | |
ALTER TABLE [dbo].[OrderComments] CHECK CONSTRAINT [FK_OrderComments_Users] | |
GO | |
/****** Object: ForeignKey [FK_Orders_OrderTypes] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[Orders] WITH CHECK ADD CONSTRAINT [FK_Orders_OrderTypes] FOREIGN KEY([OrderTypeId]) | |
REFERENCES [dbo].[OrderTypes] ([Id]) | |
GO | |
ALTER TABLE [dbo].[Orders] CHECK CONSTRAINT [FK_Orders_OrderTypes] | |
GO | |
/****** Object: ForeignKey [FK_Orders_ShippingTypes] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[Orders] WITH CHECK ADD CONSTRAINT [FK_Orders_ShippingTypes] FOREIGN KEY([ShippingTypeId]) | |
REFERENCES [dbo].[ShippingTypes] ([Id]) | |
GO | |
ALTER TABLE [dbo].[Orders] CHECK CONSTRAINT [FK_Orders_ShippingTypes] | |
GO | |
/****** Object: ForeignKey [FK_Orders_Workgroups] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[Orders] WITH CHECK ADD CONSTRAINT [FK_Orders_Workgroups] FOREIGN KEY([WorkgroupId]) | |
REFERENCES [dbo].[Workgroups] ([Id]) | |
GO | |
ALTER TABLE [dbo].[Orders] CHECK CONSTRAINT [FK_Orders_Workgroups] | |
GO | |
/****** Object: ForeignKey [FK_OrderTracking_Orders] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[OrderTracking] WITH CHECK ADD CONSTRAINT [FK_OrderTracking_Orders] FOREIGN KEY([OrderId]) | |
REFERENCES [dbo].[Orders] ([Id]) | |
GO | |
ALTER TABLE [dbo].[OrderTracking] CHECK CONSTRAINT [FK_OrderTracking_Orders] | |
GO | |
/****** Object: ForeignKey [FK_OrderTracking_Users] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[OrderTracking] WITH CHECK ADD CONSTRAINT [FK_OrderTracking_Users] FOREIGN KEY([UserId]) | |
REFERENCES [dbo].[Users] ([Id]) | |
GO | |
ALTER TABLE [dbo].[OrderTracking] CHECK CONSTRAINT [FK_OrderTracking_Users] | |
GO | |
/****** Object: ForeignKey [FK_Splits_LineItems] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[Splits] WITH CHECK ADD CONSTRAINT [FK_Splits_LineItems] FOREIGN KEY([LineItemId]) | |
REFERENCES [dbo].[LineItems] ([Id]) | |
GO | |
ALTER TABLE [dbo].[Splits] CHECK CONSTRAINT [FK_Splits_LineItems] | |
GO | |
/****** Object: ForeignKey [FK_Splits_Orders] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[Splits] WITH CHECK ADD CONSTRAINT [FK_Splits_Orders] FOREIGN KEY([OrderId]) | |
REFERENCES [dbo].[Orders] ([Id]) | |
GO | |
ALTER TABLE [dbo].[Splits] CHECK CONSTRAINT [FK_Splits_Orders] | |
GO | |
/****** Object: ForeignKey [FK_Splits_vAccounts] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[Splits] WITH CHECK ADD CONSTRAINT [FK_Splits_vAccounts] FOREIGN KEY([AccountId]) | |
REFERENCES [dbo].[vAccounts] ([Id]) | |
GO | |
ALTER TABLE [dbo].[Splits] CHECK CONSTRAINT [FK_Splits_vAccounts] | |
GO | |
/****** Object: ForeignKey [FK_vAccounts_vOrganizations] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[vAccounts] WITH CHECK ADD CONSTRAINT [FK_vAccounts_vOrganizations] FOREIGN KEY([OrganizationId]) | |
REFERENCES [dbo].[vOrganizations] ([Id]) | |
GO | |
ALTER TABLE [dbo].[vAccounts] CHECK CONSTRAINT [FK_vAccounts_vOrganizations] | |
GO | |
/****** Object: ForeignKey [FK_vVendorAddresses_vVendors] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[vVendorAddresses] WITH CHECK ADD CONSTRAINT [FK_vVendorAddresses_vVendors] FOREIGN KEY([VendorId]) | |
REFERENCES [dbo].[vVendors] ([Id]) | |
GO | |
ALTER TABLE [dbo].[vVendorAddresses] CHECK CONSTRAINT [FK_vVendorAddresses_vVendors] | |
GO | |
/****** Object: ForeignKey [FK_WorkgroupAccountPermissions_Roles] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[WorkgroupAccountPermissions] WITH CHECK ADD CONSTRAINT [FK_WorkgroupAccountPermissions_Roles] FOREIGN KEY([RoleId]) | |
REFERENCES [dbo].[Roles] ([Id]) | |
GO | |
ALTER TABLE [dbo].[WorkgroupAccountPermissions] CHECK CONSTRAINT [FK_WorkgroupAccountPermissions_Roles] | |
GO | |
/****** Object: ForeignKey [FK_WorkgroupAccountPermissions_Users] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[WorkgroupAccountPermissions] WITH CHECK ADD CONSTRAINT [FK_WorkgroupAccountPermissions_Users] FOREIGN KEY([UserId]) | |
REFERENCES [dbo].[Users] ([Id]) | |
GO | |
ALTER TABLE [dbo].[WorkgroupAccountPermissions] CHECK CONSTRAINT [FK_WorkgroupAccountPermissions_Users] | |
GO | |
/****** Object: ForeignKey [FK_WorkgroupAccountPermissions_WorkgroupAccounts] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[WorkgroupAccountPermissions] WITH CHECK ADD CONSTRAINT [FK_WorkgroupAccountPermissions_WorkgroupAccounts] FOREIGN KEY([WorkgroupAccountId]) | |
REFERENCES [dbo].[WorkgroupAccounts] ([Id]) | |
GO | |
ALTER TABLE [dbo].[WorkgroupAccountPermissions] CHECK CONSTRAINT [FK_WorkgroupAccountPermissions_WorkgroupAccounts] | |
GO | |
/****** Object: ForeignKey [FK_WorkgroupAccounts_vAccounts] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[WorkgroupAccounts] WITH CHECK ADD CONSTRAINT [FK_WorkgroupAccounts_vAccounts] FOREIGN KEY([AccountId]) | |
REFERENCES [dbo].[vAccounts] ([Id]) | |
GO | |
ALTER TABLE [dbo].[WorkgroupAccounts] CHECK CONSTRAINT [FK_WorkgroupAccounts_vAccounts] | |
GO | |
/****** Object: ForeignKey [FK_WorkgroupAccounts_Workgroups] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[WorkgroupAccounts] WITH CHECK ADD CONSTRAINT [FK_WorkgroupAccounts_Workgroups] FOREIGN KEY([WorkgroupId]) | |
REFERENCES [dbo].[Workgroups] ([Id]) | |
GO | |
ALTER TABLE [dbo].[WorkgroupAccounts] CHECK CONSTRAINT [FK_WorkgroupAccounts_Workgroups] | |
GO | |
/****** Object: ForeignKey [FK_WorkgroupAddresses_States] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[WorkgroupAddresses] WITH CHECK ADD CONSTRAINT [FK_WorkgroupAddresses_States] FOREIGN KEY([StateId]) | |
REFERENCES [dbo].[States] ([Id]) | |
GO | |
ALTER TABLE [dbo].[WorkgroupAddresses] CHECK CONSTRAINT [FK_WorkgroupAddresses_States] | |
GO | |
/****** Object: ForeignKey [FK_WorkgroupAddresses_Workgroups] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[WorkgroupAddresses] WITH CHECK ADD CONSTRAINT [FK_WorkgroupAddresses_Workgroups] FOREIGN KEY([WorkgroupId]) | |
REFERENCES [dbo].[Workgroups] ([Id]) | |
GO | |
ALTER TABLE [dbo].[WorkgroupAddresses] CHECK CONSTRAINT [FK_WorkgroupAddresses_Workgroups] | |
GO | |
/****** Object: ForeignKey [FK_WorkgroupPermissions_Roles] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[WorkgroupPermissions] WITH CHECK ADD CONSTRAINT [FK_WorkgroupPermissions_Roles] FOREIGN KEY([RoleTypeId]) | |
REFERENCES [dbo].[Roles] ([Id]) | |
GO | |
ALTER TABLE [dbo].[WorkgroupPermissions] CHECK CONSTRAINT [FK_WorkgroupPermissions_Roles] | |
GO | |
/****** Object: ForeignKey [FK_WorkgroupPermissions_Users] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[WorkgroupPermissions] WITH CHECK ADD CONSTRAINT [FK_WorkgroupPermissions_Users] FOREIGN KEY([UserId]) | |
REFERENCES [dbo].[Users] ([Id]) | |
GO | |
ALTER TABLE [dbo].[WorkgroupPermissions] CHECK CONSTRAINT [FK_WorkgroupPermissions_Users] | |
GO | |
/****** Object: ForeignKey [FK_WorkgroupPermissions_Workgroups] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[WorkgroupPermissions] WITH CHECK ADD CONSTRAINT [FK_WorkgroupPermissions_Workgroups] FOREIGN KEY([WorkgroupId]) | |
REFERENCES [dbo].[Workgroups] ([Id]) | |
GO | |
ALTER TABLE [dbo].[WorkgroupPermissions] CHECK CONSTRAINT [FK_WorkgroupPermissions_Workgroups] | |
GO | |
/****** Object: ForeignKey [FK_WorkgroupsXOrganizations_vOrganizations] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[WorkgroupsXOrganizations] WITH CHECK ADD CONSTRAINT [FK_WorkgroupsXOrganizations_vOrganizations] FOREIGN KEY([OrganizationId]) | |
REFERENCES [dbo].[vOrganizations] ([Id]) | |
GO | |
ALTER TABLE [dbo].[WorkgroupsXOrganizations] CHECK CONSTRAINT [FK_WorkgroupsXOrganizations_vOrganizations] | |
GO | |
/****** Object: ForeignKey [FK_WorkgroupsXOrganizations_Workgroups] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[WorkgroupsXOrganizations] WITH CHECK ADD CONSTRAINT [FK_WorkgroupsXOrganizations_Workgroups] FOREIGN KEY([WorkgroupId]) | |
REFERENCES [dbo].[Workgroups] ([Id]) | |
GO | |
ALTER TABLE [dbo].[WorkgroupsXOrganizations] CHECK CONSTRAINT [FK_WorkgroupsXOrganizations_Workgroups] | |
GO | |
/****** Object: ForeignKey [FK_WorkgroupVendors_Workgroups] Script Date: 08/19/2011 09:22:47 ******/ | |
ALTER TABLE [dbo].[WorkgroupVendors] WITH CHECK ADD CONSTRAINT [FK_WorkgroupVendors_Workgroups] FOREIGN KEY([WorkgroupId]) | |
REFERENCES [dbo].[Workgroups] ([Id]) | |
GO | |
ALTER TABLE [dbo].[WorkgroupVendors] CHECK CONSTRAINT [FK_WorkgroupVendors_Workgroups] | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment