From f01a195369b88d3761f01d1920d61f0362b5d002 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Fri, 12 Oct 2012 10:13:50 -0200 Subject: [PATCH] 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 --- src/SQLCE4Umbraco/Sql/Total.sql | 50 +++++++++---------- .../Sql/Version4_8_Upgrade.sql | 37 +++++++------- src/SQLCE4Umbraco/SqlCE4Umbraco.csproj | 2 + src/SQLCE4Umbraco/SqlCEInstaller.cs | 1 + src/SQLCE4Umbraco/SqlCEResources.resx | 3 ++ src/SQLCE4Umbraco/SqlCEResources1.Designer.cs | 25 ++++++++-- src/Umbraco.Web/Umbraco.Web.csproj | 4 +- .../SqlHelpers/MySql/MySqlInstaller.cs | 1 + .../SqlServer/Sql/Version4_8_Upgrade.sql | 26 +++++----- .../SqlServer/SqlResources.Designer.cs | 25 ++++++++-- .../SqlHelpers/SqlServer/SqlResources.resx | 8 +-- .../SqlServer/SqlServerInstaller.cs | 1 + .../Utility/Installer/DatabaseVersion.cs | 4 +- 13 files changed, 118 insertions(+), 69 deletions(-) rename src/{umbraco.datalayer/SqlHelpers/MySql => SQLCE4Umbraco}/Sql/Version4_8_Upgrade.sql (69%) diff --git a/src/SQLCE4Umbraco/Sql/Total.sql b/src/SQLCE4Umbraco/Sql/Total.sql index 6a57d2f8dc..cc826154cc 100644 --- a/src/SQLCE4Umbraco/Sql/Total.sql +++ b/src/SQLCE4Umbraco/Sql/Total.sql @@ -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) ; diff --git a/src/umbraco.datalayer/SqlHelpers/MySql/Sql/Version4_8_Upgrade.sql b/src/SQLCE4Umbraco/Sql/Version4_8_Upgrade.sql similarity index 69% rename from src/umbraco.datalayer/SqlHelpers/MySql/Sql/Version4_8_Upgrade.sql rename to src/SQLCE4Umbraco/Sql/Version4_8_Upgrade.sql index 7290db855c..3295f407ae 100644 --- a/src/umbraco.datalayer/SqlHelpers/MySql/Sql/Version4_8_Upgrade.sql +++ b/src/SQLCE4Umbraco/Sql/Version4_8_Upgrade.sql @@ -4,7 +4,7 @@ IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT - Database version: 4.8.0.0 + 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. @@ -29,45 +29,42 @@ SP_RENAME 'cmsTab', 'cmsPropertyTypeGroup' -- add parent Group to new cmsPropertyTypeGroup ALTER TABLE [cmsPropertyTypeGroup] ADD [parentGroupId] int NULL -CONSTRAINT [df_cmsPropertyTypeGroup_parentGroupId] DEFAULT NULL +CONSTRAINT [DF_cmsPropertyTypeGroup_parentGroupId] DEFAULT NULL ; ALTER TABLE [cmsPropertyTypeGroup] -WITH CHECK ADD CONSTRAINT [FK_cmsPropertyTypeGroup_cmsPropertyTypeGroup] FOREIGN KEY([parentGroupId]) +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 +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 +CONSTRAINT [DF_cmsContentType_isContainer] DEFAULT 0 ; ALTER TABLE [cmsContentType] ADD [allowAtRoot] bit NOT NULL -CONSTRAINT [df_cmsContentType_allowAtRoot] DEFAULT 0 +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 -)) +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 ; --- 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' -; \ No newline at end of file +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] +; diff --git a/src/SQLCE4Umbraco/SqlCE4Umbraco.csproj b/src/SQLCE4Umbraco/SqlCE4Umbraco.csproj index 0784bff0d9..442f9497c3 100644 --- a/src/SQLCE4Umbraco/SqlCE4Umbraco.csproj +++ b/src/SQLCE4Umbraco/SqlCE4Umbraco.csproj @@ -73,12 +73,14 @@ + ResXFileCodeGenerator SqlCEResources1.Designer.cs + Designer diff --git a/src/SQLCE4Umbraco/SqlCEInstaller.cs b/src/SQLCE4Umbraco/SqlCEInstaller.cs index 0d60c20288..46a0fdfd16 100644 --- a/src/SQLCE4Umbraco/SqlCEInstaller.cs +++ b/src/SQLCE4Umbraco/SqlCEInstaller.cs @@ -26,6 +26,7 @@ namespace SqlCE4Umbraco /// The specifications to determine the database version. private static readonly VersionSpecs[] m_VersionSpecs = new VersionSpecs[] { + new VersionSpecs("SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS WHERE CONSTRAINT_NAME = 'FK_cmsPropertyType_cmsTab'", 1, DatabaseVersion.Version4_9), new VersionSpecs("SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS LEFT OUTER JOIN umbracoApp ON appAlias = appAlias WHERE CONSTRAINT_NAME = 'FK_umbracoUser2app_umbracoApp'", 0, DatabaseVersion.Version4_8), new VersionSpecs("SELECT id FROM umbracoNode WHERE id = -21", 1, DatabaseVersion.Version4_1), new VersionSpecs("SELECT action FROM umbracoAppTree",DatabaseVersion.Version4), diff --git a/src/SQLCE4Umbraco/SqlCEResources.resx b/src/SQLCE4Umbraco/SqlCEResources.resx index cb62be9b84..479fca991b 100644 --- a/src/SQLCE4Umbraco/SqlCEResources.resx +++ b/src/SQLCE4Umbraco/SqlCEResources.resx @@ -124,4 +124,7 @@ sql\version4_1_upgrade.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + + sql\version4_8_upgrade.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + \ No newline at end of file diff --git a/src/SQLCE4Umbraco/SqlCEResources1.Designer.cs b/src/SQLCE4Umbraco/SqlCEResources1.Designer.cs index ebc7ed1154..5fa612bc71 100644 --- a/src/SQLCE4Umbraco/SqlCEResources1.Designer.cs +++ b/src/SQLCE4Umbraco/SqlCEResources1.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.17626 +// Runtime Version:4.0.30319.18010 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -73,11 +73,11 @@ namespace SQLCE4Umbraco { /// ///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. - /// The first 3 digits depict the Umbraco [rest of string was truncated]";. + /// The first 3 digits depict the Umbraco [rest of string was truncated]";. /// internal static string Total { get { @@ -103,5 +103,24 @@ namespace SQLCE4Umbraco { return ResourceManager.GetString("Version4_1_Upgrade", resourceCulture); } } + + /// + /// Looks up a localized string similar to /******************************************************************************************* + /// + /// 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 [rest of string was truncated]";. + /// + internal static string Version4_8_Upgrade { + get { + return ResourceManager.GetString("Version4_8_Upgrade", resourceCulture); + } + } } } diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index b09b108733..5f53a21809 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -1852,7 +1852,9 @@ - + + ASPXCodeBehind + diff --git a/src/umbraco.datalayer/SqlHelpers/MySql/MySqlInstaller.cs b/src/umbraco.datalayer/SqlHelpers/MySql/MySqlInstaller.cs index 617d1daba3..e41ece5d8d 100644 --- a/src/umbraco.datalayer/SqlHelpers/MySql/MySqlInstaller.cs +++ b/src/umbraco.datalayer/SqlHelpers/MySql/MySqlInstaller.cs @@ -25,6 +25,7 @@ namespace umbraco.DataLayer.SqlHelpers.MySql /// The specifications to determine the database version. private static readonly VersionSpecs[] m_VersionSpecs = new VersionSpecs[] { + new VersionSpecs("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'cmsContentType2ContentType'", 0, DatabaseVersion.Version4_9), new VersionSpecs("SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS LEFT OUTER JOIN umbracoApp ON appAlias = appAlias WHERE CONSTRAINT_NAME = 'FK_umbracoUser2app_umbracoApp'", 0, DatabaseVersion.Version4_8), new VersionSpecs("SELECT id FROM umbracoNode WHERE id = -21", 1, DatabaseVersion.Version4_1), new VersionSpecs("SELECT action FROM umbracoAppTree", DatabaseVersion.Version4), diff --git a/src/umbraco.datalayer/SqlHelpers/SqlServer/Sql/Version4_8_Upgrade.sql b/src/umbraco.datalayer/SqlHelpers/SqlServer/Sql/Version4_8_Upgrade.sql index 7290db855c..f0831a7949 100644 --- a/src/umbraco.datalayer/SqlHelpers/SqlServer/Sql/Version4_8_Upgrade.sql +++ b/src/umbraco.datalayer/SqlHelpers/SqlServer/Sql/Version4_8_Upgrade.sql @@ -4,7 +4,7 @@ IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT - Database version: 4.8.0.0 + 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. @@ -32,7 +32,7 @@ ADD [parentGroupId] int NULL CONSTRAINT [df_cmsPropertyTypeGroup_parentGroupId] DEFAULT NULL ; ALTER TABLE [cmsPropertyTypeGroup] -WITH CHECK ADD CONSTRAINT [FK_cmsPropertyTypeGroup_cmsPropertyTypeGroup] FOREIGN KEY([parentGroupId]) +ADD CONSTRAINT [FK_cmsPropertyTypeGroup_cmsPropertyTypeGroup] FOREIGN KEY([parentGroupId]) REFERENCES [cmsPropertyTypeGroup] ([id]) ; -- add sortOrder to cmsContentTypeAllowedContentType @@ -49,15 +49,11 @@ ALTER TABLE [cmsContentType] ADD [allowAtRoot] bit NOT NULL CONSTRAINT [df_cmsContentType_allowAtRoot] DEFAULT 0 ; +--TODO: Temporarily disabled these two to make it CE compliant.. -- 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 -)) +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) @@ -69,5 +65,11 @@ ALTER TABLE [cmsContentType] DROP CONSTRAINT [DF_cmsContentType_masterContentTyp ALTER TABLE [cmsContentType] DROP COLUMN [masterContentType] ; -- rename tab to propertyGroup on propertyType -SP_RENAME 'cmsPropertyType.tabId', 'propertyTypeGroupId', 'COLUMN' -; \ No newline at end of file +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] +; diff --git a/src/umbraco.datalayer/SqlHelpers/SqlServer/SqlResources.Designer.cs b/src/umbraco.datalayer/SqlHelpers/SqlServer/SqlResources.Designer.cs index 5de0b508f1..4fd699fe96 100644 --- a/src/umbraco.datalayer/SqlHelpers/SqlServer/SqlResources.Designer.cs +++ b/src/umbraco.datalayer/SqlHelpers/SqlServer/SqlResources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.269 +// Runtime Version:4.0.30319.18010 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -73,11 +73,11 @@ namespace umbraco.DataLayer.SqlHelpers.SqlServer { /// ///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. - /// The first 3 digits depict the Umbraco versi [rest of string was truncated]";. + /// The first 3 digits depict the Umbraco vers [rest of string was truncated]";. /// internal static string Total { get { @@ -129,6 +129,25 @@ namespace umbraco.DataLayer.SqlHelpers.SqlServer { } } + /// + /// Looks up a localized string similar to /******************************************************************************************* + /// + /// 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 [rest of string was truncated]";. + /// + internal static string Version4_8_Upgrade { + get { + return ResourceManager.GetString("Version4_8_Upgrade", resourceCulture); + } + } + /// /// Looks up a localized string similar to /******************************************************************************************* /// diff --git a/src/umbraco.datalayer/SqlHelpers/SqlServer/SqlResources.resx b/src/umbraco.datalayer/SqlHelpers/SqlServer/SqlResources.resx index 9b9cd44123..90dd03d575 100644 --- a/src/umbraco.datalayer/SqlHelpers/SqlServer/SqlResources.resx +++ b/src/umbraco.datalayer/SqlHelpers/SqlServer/SqlResources.resx @@ -112,10 +112,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -124,10 +124,12 @@ sql\version3_upgrade.sql;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - sql\version4_1_upgrade.sql;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + + sql\version4_8_upgrade.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + sql\version4_upgrade.sql;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 diff --git a/src/umbraco.datalayer/SqlHelpers/SqlServer/SqlServerInstaller.cs b/src/umbraco.datalayer/SqlHelpers/SqlServer/SqlServerInstaller.cs index 74918e459b..52176b0004 100644 --- a/src/umbraco.datalayer/SqlHelpers/SqlServer/SqlServerInstaller.cs +++ b/src/umbraco.datalayer/SqlHelpers/SqlServer/SqlServerInstaller.cs @@ -24,6 +24,7 @@ namespace umbraco.DataLayer.SqlHelpers.SqlServer /// The specifications to determine the database version. private static readonly VersionSpecs[] m_VersionSpecs = new VersionSpecs[] { + new VersionSpecs("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'cmsContentType2ContentType'", 0, DatabaseVersion.Version4_9), new VersionSpecs("SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS LEFT OUTER JOIN umbracoApp ON appAlias = appAlias WHERE CONSTRAINT_NAME = 'FK_umbracoUser2app_umbracoApp'", 0, DatabaseVersion.Version4_8), new VersionSpecs("SELECT id FROM umbracoNode WHERE id = -21", 1, DatabaseVersion.Version4_1), new VersionSpecs("SELECT action FROM umbracoAppTree", DatabaseVersion.Version4), diff --git a/src/umbraco.datalayer/Utility/Installer/DatabaseVersion.cs b/src/umbraco.datalayer/Utility/Installer/DatabaseVersion.cs index fc9841cc7a..1ffcce7227 100644 --- a/src/umbraco.datalayer/Utility/Installer/DatabaseVersion.cs +++ b/src/umbraco.datalayer/Utility/Installer/DatabaseVersion.cs @@ -24,6 +24,8 @@ namespace umbraco.DataLayer.Utility.Installer /// Umbraco version 4.1. Version4_1, /// Umbraco version 4.8. - Version4_8 + Version4_8, + /// Umbraco version 4.9. + Version4_9 } }