Updates new Total.Sql for SQL Server to match the 4.10 db schema.

IMPORTANT: If you upgrade a previous 4.10 dev site, make sure to run the 'src\umbraco.datalayer\SqlHelpers\MySql\Sql\Version4_8_Upgrade.sql' script
IMPORTANT v2: The DB updates haven't been ported to SQL CE and MySQL yet, so they'll currently BREAK!
This commit is contained in:
NielsHartvig@UMBRACORATI.localdomain
2012-10-09 06:56:18 -02:00
parent ed3f715988
commit 635f09fb75
3 changed files with 117 additions and 33 deletions

View File

@@ -185,7 +185,7 @@ namespace umbraco.cms.businesslogic.web
cmsDocument.documentUser, coalesce(cmsDocument.templateId, cmsDocumentType.templateNodeId) as templateId,
umbracoNode.path, umbracoNode.sortOrder, coalesce(publishCheck.published,0) as isPublished, umbracoNode.createDate,
cmsDocument.text, cmsDocument.updateDate, cmsContentVersion.versionDate, cmsDocument.releaseDate, cmsDocument.expireDate, cmsContentType.icon, cmsContentType.alias,
cmsContentType.thumbnail, cmsContentType.description, cmsContentType.masterContentType, cmsContentType.nodeId as contentTypeId,
cmsContentType.thumbnail, cmsContentType.description, cmsContentType.nodeId as contentTypeId,
umbracoNode.nodeUser
from umbracoNode
left join umbracoNode children on children.parentId = umbracoNode.id

View File

@@ -0,0 +1,73 @@
/*******************************************************************************************
Umbraco database installation script for SQL Server (upgrade from Umbraco 4.0.x)
IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT
Database version: 4.8.0.0
Please increment this version number if ANY change is made to this script,
so compatibility with scripts for other database systems can be verified easily.
The first 3 digits depict the Umbraco version, the last digit is the database version.
(e.g. version 4.0.0.3 means "Umbraco version 4.0.0, database version 3")
Check-in policy: only commit this script if
* you ran the Umbraco installer completely;
* you ran it on the targetted database system;
* you ran the Runway and Module installations;
* you were able to browse the Boost site;
* you were able to open the Umbraco administration panel;
* you have documented the code change in this script;
* you have incremented the version number in this script.
IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT
********************************************************************************************/
-- rename cmsTab
SP_RENAME 'cmsTab', 'cmsPropertyTypeGroup'
;
-- add parent Group to new cmsPropertyTypeGroup
ALTER TABLE [cmsPropertyTypeGroup]
ADD [parentGroupId] int NULL
CONSTRAINT [df_cmsPropertyTypeGroup_parentGroupId] DEFAULT NULL
;
ALTER TABLE [cmsPropertyTypeGroup]
WITH CHECK ADD CONSTRAINT [FK_cmsPropertyTypeGroup_cmsPropertyTypeGroup] FOREIGN KEY([parentGroupId])
REFERENCES [cmsPropertyTypeGroup] ([id])
;
-- add sortOrder to cmsContentTypeAllowedContentType
ALTER TABLE [cmsContentTypeAllowedContentType]
ADD [sortOrder] int NOT NULL
CONSTRAINT [df_cmsContentTypeAllowedContentType_sortOrder] DEFAULT 1
;
-- add container and allowAtRoot to cmsContentType
ALTER TABLE [cmsContentType]
ADD [isContainer] bit NOT NULL
CONSTRAINT [df_cmsContentType_isContainer] DEFAULT 0
;
ALTER TABLE [cmsContentType]
ADD [allowAtRoot] bit NOT NULL
CONSTRAINT [df_cmsContentType_allowAtRoot] DEFAULT 0
;
-- Create a new cmsContentType2ContentType table
CREATE TABLE [cmsContentType2ContentType](
[parentContentTypeId] [int] NOT NULL,
[childContentTypeId] [int] NOT NULL,
CONSTRAINT [PK_cmsContentType2ContentType] PRIMARY KEY CLUSTERED
(
[parentContentTypeId] ASC,
[childContentTypeId] ASC
))
;
-- move all masterContentType information to new cmsContentType2ContentType table
INSERT INTO [cmsContentType2ContentType] (parentContentTypeId, childContentTypeId)
select masterContentType, nodeId from [cmsContentType] WHERE not [masterContentType] is null and [masterContentType] != 0
;
-- remove masterContentType column from cmsContentType now that it's replaced by a separate table
ALTER TABLE [cmsContentType] DROP CONSTRAINT [DF_cmsContentType_masterContentType]
;
ALTER TABLE [cmsContentType] DROP COLUMN [masterContentType]
;
-- rename tab to propertyGroup on propertyType
SP_RENAME 'cmsPropertyType.tabId', 'propertyTypeGroupId', 'COLUMN'
;

View File

@@ -10,7 +10,7 @@
IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT
Database version: 4.8.0.3
Database version: 4.10.0.0
Please increment this version number if ANY change is made to this script,
so compatibility with scripts for other database systems can be verified easily.
@@ -152,12 +152,23 @@ CREATE TABLE [cmsContentType]
[pk] [int] NOT NULL IDENTITY(1, 1),
[nodeId] [int] NOT NULL,
[alias] [nvarchar] (255) NULL,
[icon] [nvarchar] (255) NULL
[icon] [nvarchar] (255) NULL,
[isContainer] [bit] NOT NULL CONSTRAINT [df_cmsContentType_isContainer] DEFAULT 0,
[allowAtRoot] [bit] NOT NULL CONSTRAINT [df_cmsContentType_allowAtRoot] DEFAULT 0
)
;
ALTER TABLE [cmsContentType] ADD CONSTRAINT [PK_cmsContentType] PRIMARY KEY CLUSTERED ([pk])
;
CREATE TABLE [cmsContentType2ContentType](
[parentContentTypeId] [int] NOT NULL,
[childContentTypeId] [int] NOT NULL,
CONSTRAINT [PK_cmsContentType2ContentType] PRIMARY KEY CLUSTERED
(
[parentContentTypeId] ASC,
[childContentTypeId] ASC
))
;
CREATE TABLE [cmsMacroPropertyType]
(
[id] [smallint] NOT NULL IDENTITY(1, 1),
@@ -189,16 +200,17 @@ ALTER TABLE [umbracoStylesheetProperty] ADD CONSTRAINT [PK_stylesheetProperty] P
*/
CREATE TABLE [cmsTab]
CREATE TABLE [cmsPropertyTypeGroup]
(
[id] [int] NOT NULL IDENTITY(1, 1),
[parentGroupId] [int] NULL CONSTRAINT [df_cmsPropertyTypeGroup_parentGroupId] DEFAULT NULL,
[contenttypeNodeId] [int] NOT NULL,
[text] [nvarchar] (255) NOT NULL,
[sortorder] [int] NOT NULL
)
;
ALTER TABLE [cmsTab] ADD CONSTRAINT [PK_cmsTab] PRIMARY KEY CLUSTERED ([id])
ALTER TABLE [cmsPropertyTypeGroup] ADD CONSTRAINT [PK_cmsPropertyTypeGroup] PRIMARY KEY CLUSTERED ([id])
;
CREATE TABLE [cmsTemplate]
(
@@ -309,7 +321,7 @@ CREATE TABLE [cmsPropertyType]
[id] [int] NOT NULL IDENTITY(1, 1),
[dataTypeId] [int] NOT NULL,
[contentTypeId] [int] NOT NULL,
[tabId] [int] NULL,
[propertyTypeGroupId] [int] NULL,
[Alias] [nvarchar] (255) NOT NULL,
[Name] [nvarchar] (255) NULL,
[helpText] [nvarchar] (1000) NULL,
@@ -386,7 +398,8 @@ ALTER TABLE [umbracoAppTree] ADD CONSTRAINT [PK_umbracoAppTree] PRIMARY KEY CLUS
CREATE TABLE [cmsContentTypeAllowedContentType]
(
[Id] [int] NOT NULL,
[AllowedId] [int] NOT NULL
[AllowedId] [int] NOT NULL,
[SortOrder] [int] NOT NULL CONSTRAINT [df_cmsContentTypeAllowedContentType_sortOrder] DEFAULT 1
)
;
@@ -583,7 +596,7 @@ ALTER TABLE [cmsContentType] ADD
CONSTRAINT [FK_cmsContentType_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id])
;
ALTER TABLE [cmsPropertyType] ADD
CONSTRAINT [FK_cmsPropertyType_cmsTab] FOREIGN KEY ([tabId]) REFERENCES [cmsTab] ([id])
CONSTRAINT [FK_cmsPropertyType_cmsPropertyTypeGroup] FOREIGN KEY ([propertyTypeGroupId]) REFERENCES [cmsPropertyTypeGroup] ([id])
;
ALTER TABLE [cmsContent] ADD
CONSTRAINT [FK_cmsContent_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id])
@@ -594,7 +607,7 @@ CONSTRAINT [FK_umbracoUser2app_umbracoUser] FOREIGN KEY ([user]) REFERENCES [umb
ALTER TABLE [cmsTemplate] DROP CONSTRAINT [FK_cmsTemplate_umbracoNode]
;
ALTER TABLE [cmsPropertyType] DROP CONSTRAINT [FK_cmsPropertyType_cmsTab]
ALTER TABLE [cmsPropertyType] DROP CONSTRAINT [FK_cmsPropertyType_cmsPropertyTypeGroup]
;
ALTER TABLE [cmsContent] DROP CONSTRAINT [FK_cmsContent_umbracoNode]
;
@@ -655,7 +668,7 @@ INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [pa
SET IDENTITY_INSERT [umbracoNode] OFF
;
SET IDENTITY_INSERT [cmsContentType] ON
INSERT INTO [cmsContentType] ([pk], [nodeId], [alias], [icon]) VALUES (532, 1031, N'Folder', N'folder.gif')
INSERT INTO [cmsContentType] ([pk], [nodeId], [alias], [icon], [isContainer], [allowAtRoot]) VALUES (532, 1031, N'Folder', N'folder.gif', 1, 1)
INSERT INTO [cmsContentType] ([pk], [nodeId], [alias], [icon]) VALUES (533, 1032, N'Image', N'mediaPhoto.gif')
INSERT INTO [cmsContentType] ([pk], [nodeId], [alias], [icon]) VALUES (534, 1033, N'File', N'mediaFile.gif')
SET IDENTITY_INSERT [cmsContentType] OFF
@@ -696,22 +709,22 @@ INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroProper
INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (25, N'textMultiLine', N'umbraco.macroRenderings', N'textMultiple', N'String')
SET IDENTITY_INSERT [cmsMacroPropertyType] OFF
;
SET IDENTITY_INSERT [cmsTab] ON
INSERT INTO [cmsTab] ([id], [contenttypeNodeId], [text], [sortorder]) VALUES (3, 1032, N'Image', 1)
INSERT INTO [cmsTab] ([id], [contenttypeNodeId], [text], [sortorder]) VALUES (4, 1033, N'File', 1)
INSERT INTO [cmsTab] ([id], [contenttypeNodeId], [text], [sortorder]) VALUES (5, 1031, N'Contents', 1)
SET IDENTITY_INSERT [cmsTab] OFF
SET IDENTITY_INSERT [cmsPropertyTypeGroup] ON
INSERT INTO [cmsPropertyTypeGroup] ([id], [contenttypeNodeId], [text], [sortorder]) VALUES (3, 1032, N'Image', 1)
INSERT INTO [cmsPropertyTypeGroup] ([id], [contenttypeNodeId], [text], [sortorder]) VALUES (4, 1033, N'File', 1)
INSERT INTO [cmsPropertyTypeGroup] ([id], [contenttypeNodeId], [text], [sortorder]) VALUES (5, 1031, N'Contents', 1)
SET IDENTITY_INSERT [cmsPropertyTypeGroup] OFF
;
SET IDENTITY_INSERT [cmsPropertyType] ON
INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [tabId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (6, -90, 1032, 3, N'umbracoFile', N'Upload image', NULL, 0, 0, NULL, NULL)
INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [tabId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (7, -92, 1032, 3, N'umbracoWidth', N'Width', NULL, 0, 0, NULL, NULL)
INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [tabId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (8, -92, 1032, 3, N'umbracoHeight', N'Height', NULL, 0, 0, NULL, NULL)
INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [tabId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (9, -92, 1032, 3, N'umbracoBytes', N'Size', NULL, 0, 0, NULL, NULL)
INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [tabId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (10, -92, 1032, 3, N'umbracoExtension', N'Type', NULL, 0, 0, NULL, NULL)
INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [tabId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (24, -90, 1033, 4, N'umbracoFile', N'Upload file', NULL, 0, 0, NULL, NULL)
INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [tabId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (25, -92, 1033, 4, N'umbracoExtension', N'Type', NULL, 0, 0, NULL, NULL)
INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [tabId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (26, -92, 1033, 4, N'umbracoBytes', N'Size', NULL, 0, 0, NULL, NULL)
INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [tabId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (27, -38, 1031, 5, N'contents', N'Contents:', NULL, 0, 0, NULL, NULL)
INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [propertyTypeGroupId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (6, -90, 1032, 3, N'umbracoFile', N'Upload image', NULL, 0, 0, NULL, NULL)
INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [propertyTypeGroupId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (7, -92, 1032, 3, N'umbracoWidth', N'Width', NULL, 0, 0, NULL, NULL)
INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [propertyTypeGroupId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (8, -92, 1032, 3, N'umbracoHeight', N'Height', NULL, 0, 0, NULL, NULL)
INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [propertyTypeGroupId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (9, -92, 1032, 3, N'umbracoBytes', N'Size', NULL, 0, 0, NULL, NULL)
INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [propertyTypeGroupId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (10, -92, 1032, 3, N'umbracoExtension', N'Type', NULL, 0, 0, NULL, NULL)
INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [propertyTypeGroupId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (24, -90, 1033, 4, N'umbracoFile', N'Upload file', NULL, 0, 0, NULL, NULL)
INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [propertyTypeGroupId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (25, -92, 1033, 4, N'umbracoExtension', N'Type', NULL, 0, 0, NULL, NULL)
INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [propertyTypeGroupId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (26, -92, 1033, 4, N'umbracoBytes', N'Size', NULL, 0, 0, NULL, NULL)
INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [propertyTypeGroupId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (27, -38, 1031, 5, N'contents', N'Contents:', NULL, 0, 0, NULL, NULL)
SET IDENTITY_INSERT [cmsPropertyType] OFF
;
SET IDENTITY_INSERT [umbracoLanguage] ON
@@ -760,7 +773,7 @@ INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (40, 10
SET IDENTITY_INSERT [cmsDataType] OFF
;
ALTER TABLE [cmsTemplate] ADD CONSTRAINT [FK_cmsTemplate_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id])
ALTER TABLE [cmsPropertyType] ADD CONSTRAINT [FK_cmsPropertyType_cmsTab] FOREIGN KEY ([tabId]) REFERENCES [cmsTab] ([id])
ALTER TABLE [cmsPropertyType] ADD CONSTRAINT [FK_cmsPropertyType_cmsPropertyTypeGroup] FOREIGN KEY ([propertyTypeGroupId]) REFERENCES [cmsPropertyTypeGroup] ([id])
ALTER TABLE [cmsContent] ADD CONSTRAINT [FK_cmsContent_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id])
ALTER TABLE [cmsMacroProperty] ADD CONSTRAINT [FK_umbracoMacroProperty_umbracoMacroPropertyType] FOREIGN KEY ([macroPropertyType]) REFERENCES [cmsMacroPropertyType] ([id])
ALTER TABLE [umbracoUser2app] ADD CONSTRAINT [FK_umbracoUser2app_umbracoUser] FOREIGN KEY ([user]) REFERENCES [umbracoUser] ([id])
@@ -857,11 +870,6 @@ SELECT DISTINCT userID, nodeId, 'H' FROM umbracoUser2NodePermission WHERE userId
(SELECT umbracoUser.id FROM umbracoUserType INNER JOIN umbracoUser ON umbracoUserType.id = umbracoUser.userType WHERE (umbracoUserType.userTypeAlias = 'writer'))
;
alter TABLE [cmsContentType]
add [masterContentType] int NULL CONSTRAINT
[DF_cmsContentType_masterContentType] DEFAULT (0)
;
CREATE TABLE [cmsTagRelationship](
[nodeId] [int] NOT NULL,
[tagId] [int] NOT NULL,
@@ -1304,8 +1312,8 @@ ALTER TABLE cmsPropertyType ADD CONSTRAINT
ON DELETE NO ACTION
;
ALTER TABLE cmsTab ADD CONSTRAINT
FK_cmsTab_cmsContentType FOREIGN KEY
ALTER TABLE cmsPropertyTypeGroup ADD CONSTRAINT
FK_cmsPropertyTypeGroup_cmsContentType FOREIGN KEY
(
contenttypeNodeId
) REFERENCES cmsContentType
@@ -1588,7 +1596,10 @@ ALTER TABLE cmsMember2MemberGroup ADD CONSTRAINT
) ON UPDATE NO ACTION
ON DELETE NO ACTION
;
ALTER TABLE [cmsPropertyTypeGroup]
WITH CHECK ADD CONSTRAINT [FK_cmsPropertyTypeGroup_cmsPropertyTypeGroup] FOREIGN KEY([parentGroupId])
REFERENCES [cmsPropertyTypeGroup] ([id])
;
/***********************************************************************************************************************