Updated total.sql for SQL CE - Installs with CE from scratch work again

Upgrade detection from 4.9 > 4.10 added
UNTESTED: Upgrades from 4.9 > 4.10 should perform the database upgrade now
This commit is contained in:
Sebastiaan Janssen
2012-10-12 10:13:50 -02:00
parent 75af1e9d7c
commit f01a195369
13 changed files with 118 additions and 69 deletions

View File

@@ -10,7 +10,7 @@
IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT
Database version: 4.8.0.2
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.
@@ -146,12 +146,18 @@ 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 ([pk])
;
CREATE TABLE [cmsContentType2ContentType] ([parentContentTypeId] int NOT NULL,[childContentTypeId] int NOT NULL)
;
ALTER TABLE [cmsContentType2ContentType] ADD CONSTRAINT [cmsContentType2ContentType_PK] PRIMARY KEY ([parentContentTypeId],[childContentTypeId])
;
CREATE TABLE [cmsMacroPropertyType]
(
[id] [int] NOT NULL IDENTITY(1, 1),
@@ -183,16 +189,19 @@ ALTER TABLE [umbracoStylesheetProperty] ADD CONSTRAINT [PK_stylesheetProperty] P
*/
CREATE TABLE [cmsTab]
CREATE TABLE [cmsPropertyTypeGroup]
(
[id] [int] NOT NULL IDENTITY(1, 1),
[contenttypeNodeId] [int] NOT NULL,
[text] [nvarchar] (255) NOT NULL,
[sortorder] [int] NOT NULL
[sortorder] [int] NOT NULL,
[parentGroupId] int NULL CONSTRAINT [DF_cmsPropertyTypeGroup_parentGroupId] DEFAULT NULL
)
;
ALTER TABLE [cmsTab] ADD CONSTRAINT [PK_cmsTab] PRIMARY KEY ([id])
ALTER TABLE [cmsPropertyTypeGroup] ADD CONSTRAINT [PK_cmsPropertyTypeGroup] PRIMARY KEY ([id])
;
ALTER TABLE [cmsPropertyTypeGroup] ADD CONSTRAINT [FK_cmsPropertyTypeGroup_cmsPropertyTypeGroup] FOREIGN KEY([parentGroupId]) REFERENCES [cmsPropertyTypeGroup] ([id])
;
CREATE TABLE [cmsTemplate]
(
@@ -300,7 +309,7 @@ CREATE TABLE [cmsPropertyType]
[id] [int] NOT NULL IDENTITY(1, 1),
[dataTypeId] [int] NOT NULL,
[contentTypeId] [int] NOT NULL,
[tabId] [int] NULL,
[propertyTypeGroupId] int,
[Alias] [nvarchar] (255) NOT NULL,
[Name] [nvarchar] (255) NULL,
[helpText] [nvarchar] (1000) NULL,
@@ -377,7 +386,8 @@ ALTER TABLE [umbracoAppTree] ADD CONSTRAINT [PK_umbracoAppTree] PRIMARY KEY ([a
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)
)
;
@@ -577,9 +587,6 @@ CONSTRAINT [FK_cmsTemplate_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbra
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])
;
ALTER TABLE [cmsContent] ADD
CONSTRAINT [FK_cmsContent_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id])
;
@@ -593,8 +600,6 @@ CONSTRAINT [FK_umbracoUser2app_umbracoApp] FOREIGN KEY ([app]) REFERENCES [umbra
ALTER TABLE [cmsTemplate] DROP CONSTRAINT [FK_cmsTemplate_umbracoNode]
;
ALTER TABLE [cmsPropertyType] DROP CONSTRAINT [FK_cmsPropertyType_cmsTab]
;
ALTER TABLE [cmsContent] DROP CONSTRAINT [FK_cmsContent_umbracoNode]
;
ALTER TABLE [cmsMacroProperty] DROP CONSTRAINT [FK_umbracoMacroProperty_umbracoMacroPropertyType]
@@ -726,11 +731,11 @@ ALTER TABLE [umbracoNode] DROP CONSTRAINT [FK_umbracoNode_umbracoNode]
|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)
@@ -791,8 +796,6 @@ INSERT INTO [cmsContentTypeAllowedContentType] ([Id], [AllowedId]) VALUES (1031,
;
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 [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])
@@ -925,10 +928,6 @@ INSERT INTO umbracoAppTree (treeSilent, treeInitialize, treeSortOrder, appAlias,
VALUES (0, 1, 2, 'translation','yourTasks', 'Tasks created by you', '.sprTreeFolder', '.sprTreeFolder_o', 'umbraco', 'loadYourTasks');
;
*/
alter TABLE [cmsContentType]
add [masterContentType] int NULL CONSTRAINT
[DF_cmsContentType_masterContentType] DEFAULT (0)
;
CREATE TABLE [cmsTagRelationship](
[nodeId] [int] NOT NULL,
[tagId] [int] NOT NULL)
@@ -962,11 +961,10 @@ CREATE TABLE [cmsPreviewXml](
[versionId] [uniqueidentifier] NOT NULL,
[timestamp] [datetime] NOT NULL,
[xml] [ntext] NOT NULL)
;
/***********************************************************************************************************************
ADD NEW PRIMARY KEYS, FOREIGN KEYS AND INDEXES FOR VERSION 4.1
@@ -991,7 +989,7 @@ ALTER TABLE [umbracoUserType] ALTER COLUMN id IDENTITY(5,1)
;
ALTER TABLE [cmsMacroPropertyType] ALTER COLUMN id IDENTITY(26,1)
;
ALTER TABLE [cmsTab] ALTER COLUMN id IDENTITY(6,1)
ALTER TABLE [cmsPropertyTypeGroup] ALTER COLUMN id IDENTITY(6,1)
;
ALTER TABLE [cmsPropertyType] ALTER COLUMN id IDENTITY(28,1)
;

View File

@@ -0,0 +1,70 @@
/*******************************************************************************************
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.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.
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]
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 TABLE [cmsContentType2ContentType] ([parentContentTypeId] int NOT NULL,[childContentTypeId] int NOT NULL)
;
ALTER TABLE [cmsContentType2ContentType] ADD CONSTRAINT [cmsContentType2ContentType_PK] PRIMARY KEY ([parentContentTypeId],[childContentTypeId])
;
-- 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
;
ALTER TABLE [cmsContentType] DROP COLUMN [masterContentType]
;
-- rename tab to propertyGroup on propertyType
ALTER TABLE [cmsPropertyType] ADD [propertyTypeGroupId] int
;
UPDATE [cmsPropertyType] SET [propertyTypeGroupId] = [tabId]
;
ALTER TABLE [cmsPropertyType] DROP CONSTRAINT [FK_cmsPropertyType_cmsTab]
;
ALTER TABLE [cmsPropertyType] DROP COLUMN [tabId]
;