--
-- Script To Update Accounts_Users Table In (local)\sqlexpress.URTracker30
-- Generated 星期一, 四月 14, 2008, at 04:14 PM
--
-- Please backup (local)\sqlexpress.URTracker30 before executing this script
--



GO

GO

PRINT 'Updating Accounts_Users Table'
GO

SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, QUOTED_IDENTIFIER, CONCAT_NULL_YIELDS_NULL ON
GO

SET NUMERIC_ROUNDABORT OFF
GO




IF 1=1
   ALTER TABLE [Accounts_Users]
      ADD [ExpireDate] [datetime] NULL
GO



IF 1=1
   ALTER TABLE [Accounts_Users]
      ADD [ExtIntData1] [int] NULL
GO



IF 1=1
   ALTER TABLE [Accounts_Users]
      ADD [ExtIntData2] [int] NULL
GO



IF 1=1
   ALTER TABLE [Accounts_Users]
      ADD [ExtIntData3] [int] NULL
GO



IF 1=1
   ALTER TABLE [Accounts_Users]
      ADD [ExtIntData4] [int] NULL
GO



IF 1=1
   ALTER TABLE [Accounts_Users]
      ADD [ExtStrData1] [nvarchar] (1024) COLLATE Chinese_PRC_CI_AS NULL
GO



IF 1=1
   ALTER TABLE [Accounts_Users]
      ADD [ExtStrData2] [nvarchar] (1024) COLLATE Chinese_PRC_CI_AS NULL
GO



IF 1=1
BEGIN
   PRINT 'Accounts_Users Table Updated Successfully'
   
END ELSE
BEGIN
   PRINT 'Failed To Update Accounts_Users Table'
END
GO

--
-- Script To Update Pts_Projects Table In (local)\sqlexpress.URTracker30
-- Generated 星期一, 四月 14, 2008, at 04:14 PM
--
-- Please backup (local)\sqlexpress.URTracker30 before executing this script
--



GO

GO

PRINT 'Updating Pts_Projects Table'
GO

SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, QUOTED_IDENTIFIER, CONCAT_NULL_YIELDS_NULL ON
GO

SET NUMERIC_ROUNDABORT OFF
GO




IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_DbDirectory_Pts_Projects')
      ALTER TABLE [Pts_DbDirectory] DROP CONSTRAINT [FK_Pts_DbDirectory_Pts_Projects]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_Filters_Pts_Projects')
      ALTER TABLE [Pts_Filters] DROP CONSTRAINT [FK_Pts_Filters_Pts_Projects]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_ProblemCatalogs_Pts_Projects')
      ALTER TABLE [Pts_ProblemCatalogs] DROP CONSTRAINT [FK_Pts_ProblemCatalogs_Pts_Projects]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_ProblemCreateRoles_Pts_Projects')
      ALTER TABLE [Pts_ProblemCreateRoles] DROP CONSTRAINT [FK_Pts_ProblemCreateRoles_Pts_Projects]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_ProblemPriority_Pts_Projects')
      ALTER TABLE [Pts_ProblemPriority] DROP CONSTRAINT [FK_Pts_ProblemPriority_Pts_Projects]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_Problems_Pts_Projects')
      ALTER TABLE [Pts_Problems] DROP CONSTRAINT [FK_Pts_Problems_Pts_Projects]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_Problems_Pts_Projects1')
      ALTER TABLE [Pts_Problems] DROP CONSTRAINT [FK_Pts_Problems_Pts_Projects1]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_ProblemSeverities_Pts_Projects')
      ALTER TABLE [Pts_ProblemSeverity] DROP CONSTRAINT [FK_Pts_ProblemSeverities_Pts_Projects]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_ProblemState_Pts_Projects')
      ALTER TABLE [Pts_ProblemState] DROP CONSTRAINT [FK_Pts_ProblemState_Pts_Projects]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_ProblemType_Pts_Projects')
      ALTER TABLE [Pts_ProblemType] DROP CONSTRAINT [FK_Pts_ProblemType_Pts_Projects]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_RecordType_Pts_Projects')
      ALTER TABLE [Pts_RecordType] DROP CONSTRAINT [FK_Pts_RecordType_Pts_Projects]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_SharedItems_Pts_Projects')
      ALTER TABLE [Pts_SharedItems] DROP CONSTRAINT [FK_Pts_SharedItems_Pts_Projects]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_WorkflowSteps_Pts_Projects')
      ALTER TABLE [Pts_WorkflowSteps] DROP CONSTRAINT [FK_Pts_WorkflowSteps_Pts_Projects]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_Workgroups_Pts_Projects')
      ALTER TABLE [Pts_Workgroups] DROP CONSTRAINT [FK_Pts_Workgroups_Pts_Projects]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_Projects_Pts_ProjectCatalogs')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [FK_Pts_Projects_Pts_ProjectCatalogs]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_Projects_Pts_ProjectStates')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [FK_Pts_Projects_Pts_ProjectStates]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_ProjectCode')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_ProjectCode]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_ShortName')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_ShortName]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_Description')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_Description]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_TotalProblems')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_TotalProblems]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_TotalThreads')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_TotalThreads]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_TotalRecords')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_TotalRecords]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_DateCreated')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_DateCreated]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_ProblemTitle')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_ProblemTitle]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_ThreadTitle')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_ThreadTitle]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_RecordTitle')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_RecordTitle]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_ChangeOwnProblem')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_ChangeOwnProblem]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_EnableProblemState')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_EnableProblemState]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_MultipleThread')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_MultipleThread]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_EnableEMailNotify')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_EnableEMailNotify]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_EnableProblemPriority')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_EnableProblemPriority]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_EnableProblemSeverity')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_EnableProblemSeverity]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_EnableProblemType')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_EnableProblemType]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_EnableProblemCatalog')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_EnableProblemCatalog]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_EnableProblemDeadline')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_EnableProblemDeadline]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_VisibleToAll')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_VisibleToAll]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_EnableStateTimer')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_EnableStateTimer]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_AutoAssignedTo')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_AutoAssignedTo]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF__Pts_Proje__OpenP__3DE82FB7')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF__Pts_Proje__OpenP__3DE82FB7]
GO



IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'DF_Pts_Projects_NewProblemIndex')
      ALTER TABLE [Pts_Projects] DROP CONSTRAINT [DF_Pts_Projects_NewProblemIndex]
GO



IF 1=1
   CREATE TABLE [tmp_Pts_Projects] (
   [ProjectID] [int] IDENTITY (1, 1) NOT NULL,
   [ProjectCatalogID] [int] NOT NULL,
   [ProjectCode] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL CONSTRAINT [DF_Pts_Projects_ProjectCode] DEFAULT (''),
   [Name] [nvarchar] (250) COLLATE Chinese_PRC_CI_AS NOT NULL,
   [ShortName] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NULL CONSTRAINT [DF_Pts_Projects_ShortName] DEFAULT (''),
   [Description] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL CONSTRAINT [DF_Pts_Projects_Description] DEFAULT (''),
   [ProjectStateID] [int] NOT NULL,
   [TotalProblems] [int] NOT NULL CONSTRAINT [DF_Pts_Projects_TotalProblems] DEFAULT (0),
   [TotalThreads] [int] NOT NULL CONSTRAINT [DF_Pts_Projects_TotalThreads] DEFAULT (0),
   [TotalRecords] [int] NOT NULL CONSTRAINT [DF_Pts_Projects_TotalRecords] DEFAULT (0),
   [DateCreated] [smalldatetime] NOT NULL CONSTRAINT [DF_Pts_Projects_DateCreated] DEFAULT (getdate()),
   [ProblemTitle] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NOT NULL CONSTRAINT [DF_Pts_Projects_ProblemTitle] DEFAULT (N'问题'),
   [ThreadTitle] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NOT NULL CONSTRAINT [DF_Pts_Projects_ThreadTitle] DEFAULT (N'任务'),
   [RecordTitle] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NOT NULL CONSTRAINT [DF_Pts_Projects_RecordTitle] DEFAULT (N'记录'),
   [OnlyViewOwnProblem] [bit] NOT NULL CONSTRAINT [DF_Pts_Projects_ChangeOwnProblem] DEFAULT (1),
   [EnableProblemState] [bit] NOT NULL CONSTRAINT [DF_Pts_Projects_EnableProblemState] DEFAULT (1),
   [EnableMultipleThread] [bit] NOT NULL CONSTRAINT [DF_Pts_Projects_MultipleThread] DEFAULT (0),
   [EnableEmailNotify] [bit] NOT NULL CONSTRAINT [DF_Pts_Projects_EnableEMailNotify] DEFAULT (1),
   [EnableProblemPriority] [bit] NOT NULL CONSTRAINT [DF_Pts_Projects_EnableProblemPriority] DEFAULT (1),
   [EnableProblemSeverity] [bit] NOT NULL CONSTRAINT [DF_Pts_Projects_EnableProblemSeverity] DEFAULT (1),
   [EnableProblemType] [bit] NOT NULL CONSTRAINT [DF_Pts_Projects_EnableProblemType] DEFAULT (1),
   [EnableProblemCatalog] [bit] NOT NULL CONSTRAINT [DF_Pts_Projects_EnableProblemCatalog] DEFAULT (1),
   [EnableProblemDeadline] [bit] NOT NULL CONSTRAINT [DF_Pts_Projects_EnableProblemDeadline] DEFAULT (1),
   [VisibleToAll] [bit] NOT NULL CONSTRAINT [DF_Pts_Projects_VisibleToAll] DEFAULT (1),
   [EnableStateTimer] [bit] NOT NULL CONSTRAINT [DF_Pts_Projects_EnableStateTimer] DEFAULT (1),
   [AutoAssignedTo] [int] NULL CONSTRAINT [DF_Pts_Projects_AutoAssignedTo] DEFAULT (1),
   [OpenProblems] [int] NOT NULL CONSTRAINT [DF__Pts_Proje__OpenP__3DE82FB7] DEFAULT (0),
   [NewProblemIndex] [int] NOT NULL CONSTRAINT [DF_Pts_Projects_NewProblemIndex] DEFAULT (1),
   [ExtendedSettings] [ntext] COLLATE Chinese_PRC_CI_AS NULL,
   [SecurityLevel] [int] NOT NULL CONSTRAINT [DF_Pts_Projects_SecurityLevel] DEFAULT ((2)),
   [KeyWords] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL
)
GO



IF 1=1
   SET IDENTITY_INSERT [tmp_Pts_Projects] ON
GO



IF 1=1
   INSERT INTO [tmp_Pts_Projects] ([ProjectID], [ProjectCatalogID], [ProjectCode], [Name], [ShortName], [Description], [ProjectStateID], [TotalProblems], [TotalThreads], [TotalRecords], [DateCreated], [ProblemTitle], [ThreadTitle], [RecordTitle], [OnlyViewOwnProblem], [EnableProblemState], [EnableMultipleThread], [EnableEmailNotify], [EnableProblemPriority], [EnableProblemSeverity], [EnableProblemType], [EnableProblemCatalog], [EnableProblemDeadline], [VisibleToAll], [EnableStateTimer], [AutoAssignedTo], [OpenProblems], [NewProblemIndex], [ExtendedSettings], [KeyWords])
   SELECT [ProjectID], [ProjectCatalogID], [ProjectCode], [Name], [ShortName], [Description], [ProjectStateID], [TotalProblems], [TotalThreads], [TotalRecords], [DateCreated], [ProblemTitle], [ThreadTitle], [RecordTitle], [OnlyViewOwnProblem], [EnableProblemState], [EnableMultipleThread], [EnableEmailNotify], [EnableProblemPriority], [EnableProblemSeverity], [EnableProblemType], [EnableProblemCatalog], [EnableProblemDeadline], [VisibleToAll], [EnableStateTimer], [AutoAssignedTo], [OpenProblems], [NewProblemIndex], [ExtendedSettings], NULL
   FROM [Pts_Projects]
GO



IF 1=1
   SET IDENTITY_INSERT [tmp_Pts_Projects] OFF
GO



IF 1=1
   DROP TABLE [Pts_Projects]
GO

sp_rename N'[tmp_Pts_Projects]', N'Pts_Projects'



IF 1=1
   ALTER TABLE [Pts_Projects] ADD CONSTRAINT [PK_Pts_Projects] PRIMARY KEY CLUSTERED ([ProjectID])
GO



IF 1=1
BEGIN
   PRINT 'Pts_Projects Table Updated Successfully'
   
END ELSE
BEGIN
   PRINT 'Failed To Update Pts_Projects Table'
END
GO


--
-- Script To Update Pts_ProblemCatalogs Table In (local)\sqlexpress.URTracker30
-- Generated 星期一, 四月 14, 2008, at 04:14 PM
--
-- Please backup (local)\sqlexpress.URTracker30 before executing this script
--



GO

GO

PRINT 'Updating Pts_ProblemCatalogs Table'
GO

SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, QUOTED_IDENTIFIER, CONCAT_NULL_YIELDS_NULL ON
GO

SET NUMERIC_ROUNDABORT OFF
GO




IF 1=1
   ALTER TABLE [Pts_ProblemCatalogs]
      ADD [ResponseUser] [int] NULL
GO



IF 1=1
BEGIN
   PRINT 'Pts_ProblemCatalogs Table Updated Successfully'
   
END ELSE
BEGIN
   PRINT 'Failed To Update Pts_ProblemCatalogs Table'
END
GO

--
-- Script To Update Pts_ProblemFieldReadableWorkgroup Table In (local)\sqlexpress.URTracker30
-- Generated 星期一, 四月 14, 2008, at 04:14 PM
--
-- Please backup (local)\sqlexpress.URTracker30 before executing this script
--



GO

GO

PRINT 'Updating Pts_ProblemFieldReadableWorkgroup Table'
GO

SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, QUOTED_IDENTIFIER, CONCAT_NULL_YIELDS_NULL ON
GO

SET NUMERIC_ROUNDABORT OFF
GO



IF 1=1
BEGIN
   PRINT 'Pts_ProblemFieldReadableWorkgroup Table Updated Successfully'
   
END ELSE
BEGIN
   PRINT 'Failed To Update Pts_ProblemFieldReadableWorkgroup Table'
END
GO


--
-- Script To Create Pts_ProblemRelatedArticles Table In (local)\sqlexpress.URTracker30
-- Generated 星期一, 四月 14, 2008, at 04:14 PM
--
-- Please backup (local)\sqlexpress.URTracker30 before executing this script
--



GO

GO

PRINT 'Creating Pts_ProblemRelatedArticles Table'
GO

SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, QUOTED_IDENTIFIER, CONCAT_NULL_YIELDS_NULL ON
GO

SET NUMERIC_ROUNDABORT OFF
GO

CREATE TABLE [Pts_ProblemRelatedArticles] (
   [ProblemID] [int] NOT NULL,
   [ArticleID] [int] NOT NULL
)
GO



IF 1=1
   CREATE INDEX [IX_Pts_ProblemRelateArticles] ON [Pts_ProblemRelatedArticles] ([ProblemID])
GO



IF 1=1
BEGIN
   PRINT 'Pts_ProblemRelatedArticles Table Added Successfully'
   
END ELSE
BEGIN
   PRINT 'Failed To Add Pts_ProblemRelatedArticles Table'
END
GO

--
-- Script To Update Pts_ProblemState Table In (local)\sqlexpress.URTracker30
-- Generated 星期一, 四月 14, 2008, at 04:14 PM
--
-- Please backup (local)\sqlexpress.URTracker30 before executing this script
--



GO

GO

PRINT 'Updating Pts_ProblemState Table'
GO

SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, QUOTED_IDENTIFIER, CONCAT_NULL_YIELDS_NULL ON
GO

SET NUMERIC_ROUNDABORT OFF
GO




IF 1=1
   ALTER TABLE [Pts_ProblemState]
      ADD [ExtendedSettings] [ntext] COLLATE Chinese_PRC_CI_AS NULL
GO



IF 1=1
BEGIN
   PRINT 'Pts_ProblemState Table Updated Successfully'
   
END ELSE
BEGIN
   PRINT 'Failed To Update Pts_ProblemState Table'
END
GO

--
-- Script To Update Pts_Problems Table In (local)\sqlexpress.URTracker30
-- Generated 星期一, 四月 14, 2008, at 04:14 PM
--
-- Please backup (local)\sqlexpress.URTracker30 before executing this script
--



GO

GO

PRINT 'Updating Pts_Problems Table'
GO

SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, QUOTED_IDENTIFIER, CONCAT_NULL_YIELDS_NULL ON
GO

SET NUMERIC_ROUNDABORT OFF
GO




IF 1=1
   IF EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_Problems_Accounts_Users1')
      ALTER TABLE [Pts_Problems] DROP CONSTRAINT [FK_Pts_Problems_Accounts_Users1]
GO



IF 1=1
BEGIN
   PRINT 'Pts_Problems Table Updated Successfully'
   
END ELSE
BEGIN
   PRINT 'Failed To Update Pts_Problems Table'
END
GO

--
-- Script To Update Pts_Records Table In (local)\sqlexpress.URTracker30
-- Generated 星期一, 四月 14, 2008, at 04:14 PM
--
-- Please backup (local)\sqlexpress.URTracker30 before executing this script
--



GO

GO

PRINT 'Updating Pts_Records Table'
GO

SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, QUOTED_IDENTIFIER, CONCAT_NULL_YIELDS_NULL ON
GO

SET NUMERIC_ROUNDABORT OFF
GO




IF 1=1
   ALTER TABLE [Pts_Records]
      ADD [SrcStateID] [int] NULL
GO



IF 1=1
   ALTER TABLE [Pts_Records]
      ADD [SrcUserID] [int] NULL
GO



IF 1=1
BEGIN
   PRINT 'Pts_Records Table Updated Successfully'
   
END ELSE
BEGIN
   PRINT 'Failed To Update Pts_Records Table'
END
GO

--
-- Script To Update Pts_Projects Table In (local)\sqlexpress.URTracker30
-- Generated 星期一, 四月 14, 2008, at 04:14 PM
--
-- Please backup (local)\sqlexpress.URTracker30 before executing this script
--



GO

GO

PRINT 'Updating Pts_Projects Table'
GO



IF 1=1
   IF NOT EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_Projects_Pts_ProjectCatalogs')
      ALTER TABLE [Pts_Projects] WITH NOCHECK ADD CONSTRAINT [FK_Pts_Projects_Pts_ProjectCatalogs] FOREIGN KEY ([ProjectCatalogID]) REFERENCES [Pts_ProjectCatalogs] ([ProjectCatalogID])
GO



IF 1=1
   IF NOT EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_Projects_Pts_ProjectStates')
      ALTER TABLE [Pts_Projects] WITH NOCHECK ADD CONSTRAINT [FK_Pts_Projects_Pts_ProjectStates] FOREIGN KEY ([ProjectStateID]) REFERENCES [Pts_ProjectStates] ([ProjectStateID])
GO



IF 1=1
   IF NOT EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_DbDirectory_Pts_Projects')
      ALTER TABLE [Pts_DbDirectory] ADD CONSTRAINT [FK_Pts_DbDirectory_Pts_Projects] FOREIGN KEY ([ProjectID]) REFERENCES [Pts_Projects] ([ProjectID]) ON DELETE CASCADE
GO



IF 1=1
   IF NOT EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_Filters_Pts_Projects')
      ALTER TABLE [Pts_Filters] ADD CONSTRAINT [FK_Pts_Filters_Pts_Projects] FOREIGN KEY ([ProjectID]) REFERENCES [Pts_Projects] ([ProjectID])
GO



IF 1=1
   IF NOT EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_ProblemCatalogs_Pts_Projects')
      ALTER TABLE [Pts_ProblemCatalogs] WITH NOCHECK ADD CONSTRAINT [FK_Pts_ProblemCatalogs_Pts_Projects] FOREIGN KEY ([ProjectID]) REFERENCES [Pts_Projects] ([ProjectID])
GO



IF 1=1
   IF NOT EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_ProblemCreateRoles_Pts_Projects')
      ALTER TABLE [Pts_ProblemCreateRoles] ADD CONSTRAINT [FK_Pts_ProblemCreateRoles_Pts_Projects] FOREIGN KEY ([ProjectID]) REFERENCES [Pts_Projects] ([ProjectID])
GO



IF 1=1
   IF NOT EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_ProblemPriority_Pts_Projects')
      ALTER TABLE [Pts_ProblemPriority] WITH NOCHECK ADD CONSTRAINT [FK_Pts_ProblemPriority_Pts_Projects] FOREIGN KEY ([ProjectID]) REFERENCES [Pts_Projects] ([ProjectID])
GO



IF 1=1
   IF NOT EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_Problems_Pts_Projects')
      ALTER TABLE [Pts_Problems] WITH NOCHECK ADD CONSTRAINT [FK_Pts_Problems_Pts_Projects] FOREIGN KEY ([ProjectID]) REFERENCES [Pts_Projects] ([ProjectID])
GO



IF 1=1
   IF NOT EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_Problems_Pts_Projects1')
      ALTER TABLE [Pts_Problems] WITH NOCHECK ADD CONSTRAINT [FK_Pts_Problems_Pts_Projects1] FOREIGN KEY ([OriginProjectID]) REFERENCES [Pts_Projects] ([ProjectID])
GO



IF 1=1
   IF NOT EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_ProblemSeverities_Pts_Projects')
      ALTER TABLE [Pts_ProblemSeverity] WITH NOCHECK ADD CONSTRAINT [FK_Pts_ProblemSeverities_Pts_Projects] FOREIGN KEY ([ProjectID]) REFERENCES [Pts_Projects] ([ProjectID])
GO



IF 1=1
   IF NOT EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_ProblemState_Pts_Projects')
      ALTER TABLE [Pts_ProblemState] WITH NOCHECK ADD CONSTRAINT [FK_Pts_ProblemState_Pts_Projects] FOREIGN KEY ([ProjectID]) REFERENCES [Pts_Projects] ([ProjectID])
GO



IF 1=1
   IF NOT EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_ProblemType_Pts_Projects')
      ALTER TABLE [Pts_ProblemType] WITH NOCHECK ADD CONSTRAINT [FK_Pts_ProblemType_Pts_Projects] FOREIGN KEY ([ProjectID]) REFERENCES [Pts_Projects] ([ProjectID])
GO



IF 1=1
   IF NOT EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_RecordType_Pts_Projects')
      ALTER TABLE [Pts_RecordType] WITH NOCHECK ADD CONSTRAINT [FK_Pts_RecordType_Pts_Projects] FOREIGN KEY ([ProjectID]) REFERENCES [Pts_Projects] ([ProjectID])
GO



IF 1=1
   IF NOT EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_SharedItems_Pts_Projects')
      ALTER TABLE [Pts_SharedItems] ADD CONSTRAINT [FK_Pts_SharedItems_Pts_Projects] FOREIGN KEY ([ProjectID]) REFERENCES [Pts_Projects] ([ProjectID]) ON DELETE CASCADE
GO



IF 1=1
   IF NOT EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_WorkflowSteps_Pts_Projects')
      ALTER TABLE [Pts_WorkflowSteps] ADD CONSTRAINT [FK_Pts_WorkflowSteps_Pts_Projects] FOREIGN KEY ([ProjectID]) REFERENCES [Pts_Projects] ([ProjectID])
GO



IF 1=1
   IF NOT EXISTS (SELECT name FROM sysobjects WHERE name = N'FK_Pts_Workgroups_Pts_Projects')
      ALTER TABLE [Pts_Workgroups] WITH NOCHECK ADD CONSTRAINT [FK_Pts_Workgroups_Pts_Projects] FOREIGN KEY ([ProjectID]) REFERENCES [Pts_Projects] ([ProjectID])
GO



IF 1=1
BEGIN
   PRINT 'Pts_Projects Table Updated Successfully'
   
END ELSE
BEGIN
   PRINT 'Failed To Update Pts_Projects Table'
END
GO


--
-- Script To Update Pts_ProblemFieldReadableWorkgroup Table In (local)\sqlexpress.URTracker30
-- Generated 星期一, 四月 14, 2008, at 04:14 PM
--
-- Please backup (local)\sqlexpress.URTracker30 before executing this script
--



GO

GO

PRINT 'Updating Pts_ProblemFieldReadableWorkgroup Table'
GO





IF 1=1
BEGIN
   PRINT 'Pts_ProblemFieldReadableWorkgroup Table Updated Successfully'
   
END ELSE
BEGIN
   PRINT 'Failed To Update Pts_ProblemFieldReadableWorkgroup Table'
END
GO
