PageRenderTime 34ms CodeModel.GetById 20ms app.highlight 12ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/setup/SQLServer/MSSQLUpgradeFrom2.5to2.6.sql

#
SQL | 167 lines | 110 code | 33 blank | 24 comment | 0 complexity | 951c8586447bbdd86aec2d3276f9756b MD5 | raw file
  1
  2
  3
  4--
  5-- dbo.be_Packages
  6--
  7CREATE TABLE [dbo].[be_Packages](
  8	[PackageId] [nvarchar](128) NOT NULL,
  9	[Version] [nvarchar](128) NOT NULL,
 10 CONSTRAINT [PK_be_Packages] PRIMARY KEY CLUSTERED 
 11(
 12	[PackageId] ASC
 13)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
 14) ON [PRIMARY]
 15
 16GO
 17
 18
 19--
 20-- be_PackageFiles
 21--
 22CREATE TABLE [dbo].[be_PackageFiles](
 23	[PackageId] [nvarchar](128) NOT NULL,
 24	[FileOrder] [int] NOT NULL,
 25	[FilePath] [nvarchar](255) NOT NULL,
 26	[IsDirectory] [bit] NOT NULL,
 27 CONSTRAINT [PK_be_PackageFiles] PRIMARY KEY CLUSTERED 
 28(
 29	[PackageId] ASC,
 30	[FileOrder] ASC
 31)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
 32) ON [PRIMARY]
 33
 34GO
 35
 36
 37--
 38-- be_QuickNotes
 39--
 40CREATE TABLE [dbo].[be_QuickNotes](
 41	[QuickNoteID] [int] IDENTITY(1,1) NOT NULL,
 42	[NoteID] [uniqueidentifier] NOT NULL,
 43	[BlogID] [uniqueidentifier] NOT NULL,
 44	[UserName] [nvarchar](100) NOT NULL,
 45	[Note] [nvarchar](max) NOT NULL,
 46	[Updated] [datetime] NULL,
 47 CONSTRAINT [PK_be_QuickNotes] PRIMARY KEY CLUSTERED 
 48(
 49	[QuickNoteID] ASC
 50)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
 51) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
 52
 53GO
 54CREATE NONCLUSTERED INDEX [idx_be_NoteId_BlogId_UserName] ON [dbo].[be_QuickNotes] 
 55(
 56	[NoteID] ASC,
 57	[BlogID] ASC,
 58	[UserName] ASC
 59)
 60GO
 61
 62
 63--
 64-- be_QuickSettings
 65--
 66CREATE TABLE [dbo].[be_QuickSettings](
 67	[QuickSettingID] [int] IDENTITY(1,1) NOT NULL,
 68	[BlogID] [uniqueidentifier] NOT NULL,
 69	[UserName] [nvarchar](100) NOT NULL,
 70	[SettingName] [nvarchar](255) NOT NULL,
 71	[SettingValue] [nvarchar](255) NOT NULL,
 72 CONSTRAINT [PK_be_QuickSettings] PRIMARY KEY CLUSTERED 
 73(
 74	[QuickSettingID] ASC
 75)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
 76) ON [PRIMARY]
 77GO
 78
 79
 80--
 81-- be_FileStoreDirectory
 82--
 83CREATE TABLE [dbo].[be_FileStoreDirectory](
 84	[Id] [uniqueidentifier] NOT NULL,
 85	[ParentID] [uniqueidentifier] NULL,
 86	[BlogID] [uniqueidentifier] NOT NULL,
 87	[Name] [varchar](255) NOT NULL,
 88	[FullPath] [varchar](1000) NOT NULL,
 89	[CreateDate] [datetime] NOT NULL,
 90	[LastAccess] [datetime] NOT NULL,
 91	[LastModify] [datetime] NOT NULL,
 92 CONSTRAINT [PK_be_FileStoreDirectory] PRIMARY KEY CLUSTERED 
 93(
 94	[Id] ASC
 95)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
 96) ON [PRIMARY]
 97
 98GO
 99
100
101--
102-- be_FileStoreFiles
103--
104CREATE TABLE [dbo].[be_FileStoreFiles](
105	[FileID] [uniqueidentifier] NOT NULL,
106	[ParentDirectoryID] [uniqueidentifier] NOT NULL,
107	[Name] [varchar](255) NOT NULL,
108	[FullPath] [varchar](255) NOT NULL,
109	[Contents] [varbinary](max) NOT NULL,
110	[Size] [int] NOT NULL,
111	[CreateDate] [datetime] NOT NULL,
112	[LastAccess] [datetime] NOT NULL,
113	[LastModify] [datetime] NOT NULL,
114 CONSTRAINT [PK_be_FileStoreFiles] PRIMARY KEY CLUSTERED 
115(
116	[FileID] ASC
117)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
118) ON [PRIMARY]
119
120GO
121
122
123ALTER TABLE [dbo].[be_FileStoreFiles]  WITH CHECK ADD CONSTRAINT [FK_be_FileStoreFiles_be_FileStoreDirectory] FOREIGN KEY([ParentDirectoryID])
124REFERENCES [dbo].[be_FileStoreDirectory] ([Id])
125ON DELETE CASCADE
126GO
127
128ALTER TABLE [dbo].[be_FileStoreFiles] CHECK CONSTRAINT [FK_be_FileStoreFiles_be_FileStoreDirectory]
129GO
130
131
132--
133-- be_FileStoreFileThumbs
134--
135CREATE TABLE [dbo].[be_FileStoreFileThumbs](
136	[thumbnailId] [uniqueidentifier] NOT NULL,
137	[FileId] [uniqueidentifier] NOT NULL,
138	[size] [int] NOT NULL,
139	[contents] [varbinary](max) NOT NULL,
140 CONSTRAINT [PK_be_FileStoreFileThumbs] PRIMARY KEY CLUSTERED 
141(
142	[thumbnailId] ASC
143)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
144) ON [PRIMARY]
145
146GO
147
148ALTER TABLE [dbo].[be_FileStoreFileThumbs]  WITH CHECK ADD CONSTRAINT [FK_be_FileStoreFileThumbs_be_FileStoreFiles] FOREIGN KEY([FileId])
149REFERENCES [dbo].[be_FileStoreFiles] ([FileID])
150ON DELETE CASCADE
151GO
152
153ALTER TABLE [dbo].[be_FileStoreFileThumbs] CHECK CONSTRAINT [FK_be_FileStoreFileThumbs_be_FileStoreFiles]
154GO
155
156
157--
158-- be_Blogs
159--
160ALTER TABLE dbo.be_Blogs ADD
161	IsSiteAggregation bit NOT NULL CONSTRAINT DF_be_Blogs_IsSiteAggregation DEFAULT 0
162GO
163
164
165
166
167