upgradetable26.sql
上传用户:wenllgg125
上传日期:2020-04-09
资源大小:7277k
文件大小:5k
- -------------添加字段--------------------------------------------
- IF NOT EXISTS(SELECT * FROM SYSCOLUMNS WHERE ID=OBJECT_ID('dnt_attachments') AND name='width')
- BEGIN
- ALTER TABLE [dnt_attachments] ADD [width] INT NOT NULL DEFAULT (0)
- END
- GO
- IF NOT EXISTS(SELECT * FROM SYSCOLUMNS WHERE ID=OBJECT_ID('dnt_attachments') AND name='height')
- BEGIN
- ALTER TABLE [dnt_attachments] ADD [height] INT NOT NULL DEFAULT (0)
- END
- GO
- IF NOT EXISTS(SELECT * FROM SYSCOLUMNS WHERE ID=OBJECT_ID('dnt_users') AND name='salt')
- BEGIN
- ALTER TABLE [dnt_users] ADD [salt] NCHAR(6) NOT NULL CONSTRAINT [DF_dnt_users_salt] DEFAULT ('')
- END
- GO
- -------------修改初始值--------------------------------------------
- UPDATE [dnt_bbcodes]
- SET replacement='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="550" height="400"><param name="allowScriptAccess" value="sameDomain"/><param name="wmode" value="opaque"/><param name="movie" value="{1}"/><param name="quality" value="high"/><param name="bgcolor" value="#ffffff"/><embed src="{1}" quality="high" bgcolor="#ffffff" width="550" height="400" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent"/></object>'
- WHERE id=1
- GO
- DELETE FROM [dnt_navs]
- WHERE [name]='短消息' OR [name]='用户中心' OR [name]='系统设置' OR [name]='我的' OR [name]='统计'
- GO
- -------------重建表--------------------------------------------
- if exists (select * from sysobjects where id = object_id(N'[dnt_banned]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
- drop table [dnt_banned]
- GO
- CREATE TABLE [dnt_banned](
- [id] [smallint] IDENTITY(1,1) not null CONSTRAINT PK_dnt_bannedid primary key(id),
- [ip1] [smallint] NOT NULL,
- [ip2] [smallint] NOT NULL,
- [ip3] [smallint] NOT NULL,
- [ip4] [smallint] NOT NULL,
- [admin] [nvarchar] (50) NOT NULL,
- [dateline] [datetime] NOT NULL,
- [expiration] [datetime] NOT NULL,
- )
- GO
- if exists (select * from sysobjects where id = object_id(N'[dnt_invitation]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
- drop table [dnt_invitation]
- GO
- CREATE TABLE [dnt_invitation](
- [inviteid] [int] IDENTITY(1,1) NOT NULL CONSTRAINT [PK_dnt_invitation_inviteid] PRIMARY KEY([inviteid]),
- [invitecode] [nchar](7) NOT NULL,
- [creatorid] [int] NOT NULL,
- [creator] [nchar](20) NOT NULL,
- [successcount] [int] NOT NULL,
- [createdtime] [smalldatetime] NOT NULL,
- [expiretime] [smalldatetime] NOT NULL,
- [maxcount] [int] NOT NULL,
- [invitetype] [int] NOT NULL,
- [isdeleted] [int] NOT NULL
- )
- GO
- ALTER TABLE [dnt_invitation] ADD CONSTRAINT [DF_dnt_invitation_usecount] DEFAULT ((0)) FOR [successcount]
- GO
- ALTER TABLE [dnt_invitation] ADD CONSTRAINT [DF_dnt_invitation_isdelete] DEFAULT ((0)) FOR [isdeleted]
- GO
- if exists (select * from dbo.sysobjects where id = object_id(N'[dnt_orders]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
- drop table [dnt_orders]
- GO
- CREATE TABLE [dnt_orders](
- [orderid] [int] IDENTITY(10000,1) NOT NULL CONSTRAINT [PK_dnt_orders_orderid] PRIMARY KEY([orderid]),
- [ordercode] [char](32) NOT NULL,
- [uid] [int] NOT NULL,
- [buyer] [char](20) NOT NULL,
- [paytype] [tinyint] NOT NULL,
- [tradeno] [char](32) NULL,
- [price] [decimal](18, 2) NOT NULL,
- [orderstatus] [tinyint] NOT NULL,
- [createdtime] [smalldatetime] NOT NULL,
- [confirmedtime] [smalldatetime] NULL,
- [credit] [tinyint] NOT NULL,
- [amount] [int] NOT NULL
- )
- GO
- ALTER TABLE [dnt_orders] ADD CONSTRAINT [DF_dnt_orders_createdtime] DEFAULT (getdate()) FOR [createdtime]
- GO
- CREATE NONCLUSTERED INDEX [dnt_orders_ordercode] ON [dnt_orders]
- (
- [ordercode] ASC
- )
- GO
- -------------删除表--------------------------------------------
- IF OBJECT_ID('catchsoftstatics') IS NOT NULL
- DROP TABLE catchsoftstatics
- GO
- -------------创建索引--------------------------------------------
- CREATE NONCLUSTERED INDEX [code] ON [dnt_invitation]
- (
- [invitecode] ASC
- )
- GO
- CREATE NONCLUSTERED INDEX [creatorid] ON [dnt_invitation]
- (
- [creatorid] ASC
- )
- GO
- CREATE NONCLUSTERED INDEX [invitetype] ON [dnt_invitation]
- (
- [invitetype] ASC
- )
- GO
- CREATE INDEX [IX_dnt_topictagcaches_tid] ON dnt_topictagcaches(tid) INCLUDE (linktid, linktitle);
- GO
- CREATE INDEX [dnt_polls_tid] ON dnt_polls(tid)
- GO
- CREATE INDEX [IX_dnt_attachpaymentlog_uid] ON dnt_attachpaymentlog([uid],[aid])
- GO
- CREATE INDEX [IX_dnt_forums_status] ON dnt_forums([status],[layer],[parentid])
- GO
- CREATE INDEX [dnt_forumfields_fid] ON dnt_forumfields(fid)
- GO
- CREATE INDEX [IX_dnt_smilies_type] ON dnt_smilies ([type], [displayorder],[id]) include(code,url)
- GO
- CREATE INDEX [dnt_bbcodes_available] ON dnt_bbcodes(available)
- GO
- CREATE INDEX [dnt_moderatormanagelog_tid] ON dnt_moderatormanagelog(tid)