📄 cs_schema.sql
字号:
/*
Script created by SQL Compare from Red Gate Software Ltd at 1/22/2005 2:59:17 PM
*/
IF EXISTS (SELECT * FROM tempdb..sysobjects WHERE id=OBJECT_ID('tempdb..#tmpErrors')) DROP TABLE #tmpErrors
GO
CREATE TABLE #tmpErrors (Error int)
GO
SET XACT_ABORT ON
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
BEGIN TRANSACTION
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cs_Messages]
(
[MessageID] [int] NOT NULL,
[Language] [nvarchar] (8) NULL CONSTRAINT [DF_cs_Messages_Language] DEFAULT ('en-US'),
[Title] [nvarchar] (1024) NULL,
[Body] [ntext] NULL,
[SettingsID] [int] NULL
)
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cs_ApplicationType]
(
[ApplicationType] [smallint] NOT NULL,
[ApplicationName] [varchar] (50) NOT NULL
)
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cs_Urls]
(
[UrlID] [int] NOT NULL,
[Url] [nvarchar] (512) NOT NULL
)
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cs_Referrals]
(
[ReferralID] [int] NOT NULL IDENTITY(1000, 1),
[SettingsID] [int] NOT NULL,
[SectionID] [int] NOT NULL,
[PostID] [int] NOT NULL,
[UrlID] [int] NOT NULL,
[Hits] [int] NOT NULL,
[LastDate] [datetime] NOT NULL
)
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cs_CodeScheduleType]
(
[ScheduleTypeCode] [int] NOT NULL IDENTITY(1, 1),
[ScheduleDescription] [varchar] (30) NULL,
[SettingsID] [int] NULL
)
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cs_Smilies]
(
[SmileyID] [int] NOT NULL IDENTITY(1, 1),
[SmileyCode] [nvarchar] (10) NULL,
[SmileyUrl] [nvarchar] (256) NULL,
[SmileyText] [nvarchar] (256) NULL,
[BracketSafe] [bit] NOT NULL CONSTRAINT [DF_cs_forums_BracketSafe] DEFAULT (0),
[SettingsID] [int] NULL
)
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cs_CodeServiceType]
(
[ServiceTypeCode] [int] NOT NULL IDENTITY(1, 1),
[ServiceTypeDescription] [nvarchar] (128) NULL,
[SettingsID] [int] NULL
)
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cs_ModerationAction]
(
[ModerationAction] [int] NOT NULL,
[Description] [nvarchar] (128) NULL,
[TotalActions] [int] NOT NULL CONSTRAINT [DF_cs_ModerationAction_TotalActions] DEFAULT (0),
[SettingsID] [int] NOT NULL
)
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cs_ModerationAudit]
(
[ID] [int] IDENTITY (1, 1) NOT NULL,
[ModerationAction] [int] NOT NULL,
[PostID] [int] NULL,
[UserID] [int] NULL,
[SectionID] [int] NULL,
[ModeratorID] [int] NOT NULL,
[ModeratedOn] [datetime] NOT NULL CONSTRAINT [DF_cs_ModerationAudit_ModeratedOn] DEFAULT (getdate()),
[Notes] [nvarchar] (1024) NULL,
[SettingsID] [int] NULL
)
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cs_LinkCategories]
(
[LinkCategoryID] [int] NOT NULL IDENTITY(1, 1),
[SectionID] [int] NOT NULL,
[Name] [nvarchar] (256) NULL,
[Description] [nvarchar] (2000) NULL,
[IsEnabled] [bit] NOT NULL,
[SortOrder] [int] NOT NULL CONSTRAINT [DF_cs_LinkCategories_SortOrder] DEFAULT (0),
[SettingsID] [int] NULL
)
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cs_Moderators]
(
[UserID] [int] NOT NULL,
[SectionID] [int] NOT NULL,
[DateCreated] [datetime] NOT NULL CONSTRAINT [DF_cs_Moderators_DateCreated] DEFAULT (getdate()),
[EmailNotification] [bit] NOT NULL CONSTRAINT [DF_cs_Moderators_EmailNotification] DEFAULT (0),
[PostsModerated] [int] NOT NULL CONSTRAINT [DF_cs_Moderators_PostsModerated] DEFAULT (0),
[SettingsID] [int] NULL
)
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cs_Threads]
(
[ThreadID] [int] NOT NULL IDENTITY(1, 1),
[SectionID] [int] NOT NULL,
[UserID] [int] NOT NULL,
[PostAuthor] [nvarchar] (64) NULL CONSTRAINT [DF_cs_Threads_PostAuthor] DEFAULT (''),
[PostDate] [datetime] NOT NULL,
[ThreadDate] [datetime] NOT NULL,
[LastViewedDate] [datetime] NOT NULL CONSTRAINT [DF_cs_Threads_LastViewedDate] DEFAULT (getdate()),
[StickyDate] [datetime] NOT NULL,
[TotalViews] [int] NOT NULL CONSTRAINT [DF_cs_Threads_TotalViews] DEFAULT (0),
[TotalReplies] [int] NOT NULL CONSTRAINT [DF_cs_Threads_TotalReplies] DEFAULT (0),
[MostRecentPostAuthorID] [int] NOT NULL,
[MostRecentPostAuthor] [nvarchar] (64) NULL CONSTRAINT [DF_cs_Threads_MostRecentPostAuthor] DEFAULT (''),
[MostRecentPostID] [int] NOT NULL,
[IsLocked] [bit] NOT NULL,
[IsSticky] [bit] NOT NULL,
[IsApproved] [bit] NOT NULL CONSTRAINT [DF_cs_Threads_IsApproved] DEFAULT (1),
[RatingSum] [int] NOT NULL CONSTRAINT [DF_cs_Threads_RatingSum] DEFAULT (0),
[TotalRatings] [int] NOT NULL CONSTRAINT [DF_cs_Threads_TotalRating] DEFAULT (0),
[ThreadEmoticonID] [int] NOT NULL CONSTRAINT [DF_cs_Threads_ThreadEmoticon] DEFAULT (0),
[ThreadStatus] [int] NOT NULL CONSTRAINT [DF_cs_Threads_ThreadStatus] DEFAULT (0),
[SettingsID] [int] NULL
)
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cs_TrackedSections]
(
[SectionID] [int] NOT NULL,
[UserID] [int] NOT NULL,
[SubscriptionType] [int] NOT NULL CONSTRAINT [DF_cs_TrackedSections_SubscriptionType] DEFAULT (0),
[DateCreated] [datetime] NOT NULL CONSTRAINT [DF_cs_TrackedSections_DateCreated] DEFAULT (getdate()),
[SettingsID] [int] NULL
)
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cs_UserProfile]
(
[UserID] [int] NOT NULL,
[TimeZone] [float] NOT NULL CONSTRAINT [DF_cs_UserProfile_TimeZone] DEFAULT ((-5)),
[TotalPosts] [int] NOT NULL CONSTRAINT [DF_cs_UserProfile_TotalPosts] DEFAULT (0),
[PostSortOrder] [int] NOT NULL CONSTRAINT [DF_cs_UserProfile_PostSortOrder] DEFAULT (0),
[PostRank] [binary] (1) NOT NULL CONSTRAINT [DF_cs_UserProfile_Attributes] DEFAULT (0),
[IsAvatarApproved] [smallint] NOT NULL CONSTRAINT [DF_cs_UserProfile_IsAvatarApproved] DEFAULT (1),
[ModerationLevel] [smallint] NOT NULL CONSTRAINT [DF_cs_UserProfile_IsTrusted] DEFAULT (0),
[EnableThreadTracking] [smallint] NOT NULL CONSTRAINT [DF_cs_UserProfile_TrackYourPosts] DEFAULT (0),
[EnableDisplayUnreadThreadsOnly] [smallint] NOT NULL CONSTRAINT [DF_cs_UserProfile_ShowUnreadTopicsOnly] DEFAULT (0),
[EnableAvatar] [smallint] NOT NULL CONSTRAINT [DF_cs_UserProfile_EnableAvatar] DEFAULT (0),
[EnableDisplayInMemberList] [smallint] NOT NULL CONSTRAINT [DF_cs_UserProfile_EnableDisplayInMemberList] DEFAULT (1),
[EnablePrivateMessages] [smallint] NOT NULL CONSTRAINT [DF_cs_UserProfile_EnablePrivateMessages] DEFAULT (1),
[EnableOnlineStatus] [smallint] NOT NULL CONSTRAINT [DF_cs_UserProfile_EnableOnlineStatus] DEFAULT (1),
[EnableHtmlEmail] [smallint] NOT NULL CONSTRAINT [DF_cs_UserProfile_EnableHtmlEmail] DEFAULT (1),
[MembershipID] [uniqueidentifier] NOT NULL,
[SettingsID] [int] NOT NULL,
[PropertyNames] [ntext] NULL,
[PropertyValues] [ntext] NULL
)
GO
Create TABLE [dbo].[cs_Users] (
[MembershipID] UNIQUEIDENTIFIER NOT NULL FOREIGN KEY REFERENCES dbo.aspnet_Users(UserId) ,
[UserID] [int] IDENTITY (2100, 1) NOT NULL PRIMARY KEY CLUSTERED ,
[ForceLogin] [bit] NOT NULL CONSTRAINT [DF_cs_User_ForceLogin] DEFAULT (0),
[UserAccountStatus] [smallint] NOT NULL CONSTRAINT [DF_cs_User_Approved] DEFAULT (1),
[AppUserToken] [varchar] (128) NULL ,
[LastActivity] [datetime] NOT NULL CONSTRAINT [DF_cs_User_LastActivity] DEFAULT (getdate()),
[LastAction] [nvarchar] (1024) NULL CONSTRAINT [DF_cs_User_LastAction] DEFAULT ('')
)
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cs_Links]
(
[LinkID] [int] NOT NULL IDENTITY(1, 1),
[LinkCategoryID] [int] NOT NULL,
[Title] [nvarchar] (100) NULL,
[Url] [nvarchar] (255) NULL,
[IsEnabled] [bit] NOT NULL,
[SortOrder] [int] NOT NULL CONSTRAINT [DF_cs_Links_SortOrder] DEFAULT (0),
[SettingsID] [int] NULL
)
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cs_statistics_Site]
(
[DateCreated] [datetime] NOT NULL CONSTRAINT [DF_cs_Statistics_DateCreated] DEFAULT (getdate()),
[TotalUsers] [int] NOT NULL,
[TotalPosts] [int] NOT NULL,
[TotalModerators] [int] NOT NULL,
[TotalModeratedPosts] [int] NOT NULL,
[TotalAnonymousUsers] [int] NOT NULL CONSTRAINT [DF_cs_Statistics_TotalAnonymousUsers] DEFAULT (0),
[TotalTopics] [int] NOT NULL,
[DaysPosts] [int] NOT NULL,
[DaysTopics] [int] NOT NULL,
[NewPostsInPast24Hours] [int] NOT NULL,
[NewThreadsInPast24Hours] [int] NOT NULL,
[NewUsersInPast24Hours] [int] NOT NULL,
[MostViewsPostID] [int] NOT NULL,
[MostActivePostID] [int] NOT NULL,
[MostActiveUserID] [int] NOT NULL,
[MostReadPostID] [int] NOT NULL,
[NewestUserID] [int] NOT NULL CONSTRAINT [DF_cs_statistics_Site_NewestUserID] DEFAULT (0),
[SettingsID] [int] NULL
)
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cs_UsersOnline]
(
[UserID] [int] NOT NULL CONSTRAINT [DF_cs_UsersOnline_UserID] DEFAULT (0),
[LastActivity] [datetime] NOT NULL,
[LastAction] [nvarchar] (1024) NULL CONSTRAINT [DF_cs_UsersOnline_LastAction] DEFAULT (''),
[SettingsID] [int] NULL
)
GO
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -