From a1da12f033fa242d87a2892a97cc85b540c1fed6 Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Sat, 13 Oct 2012 07:05:11 +0500 Subject: [PATCH] Fixed SQL and CE installer to have the proper version spec queries... only by pure fluke did it ever work for 4.8! Argh! Modified the CE one so that it is consistent with the Sql one, we should be relying on the same scripts here (or at least the same logic) the one for CE will not work because even if the db is not installed it would have still returned 0 which would pass and the installer would have thought it was installed. --- src/SQLCE4Umbraco/SqlCEInstaller.cs | 6 ++++-- .../SqlHelpers/SqlServer/SqlServerInstaller.cs | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/SQLCE4Umbraco/SqlCEInstaller.cs b/src/SQLCE4Umbraco/SqlCEInstaller.cs index 1e595ada42..24184578cd 100644 --- a/src/SQLCE4Umbraco/SqlCEInstaller.cs +++ b/src/SQLCE4Umbraco/SqlCEInstaller.cs @@ -26,8 +26,10 @@ 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 * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'cmsContentType2ContentType'", 1, DatabaseVersion.Version4_9), + //This will throw an exception and will only ever have one row if it is installed, on exception the database version returned is unkown so will still work. + //NOTE: before this was set to zero and only worked by fluke! + new VersionSpecs("SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS LEFT OUTER JOIN umbracoApp ON appAlias = appAlias WHERE CONSTRAINT_NAME = 'FK_umbracoUser2app_umbracoApp'", 1, DatabaseVersion.Version4_8), new VersionSpecs("SELECT id FROM umbracoNode WHERE id = -21", 1, DatabaseVersion.Version4_1), new VersionSpecs("SELECT action FROM umbracoAppTree",DatabaseVersion.Version4), new VersionSpecs("SELECT description FROM cmsContentType",DatabaseVersion.Version3), diff --git a/src/umbraco.datalayer/SqlHelpers/SqlServer/SqlServerInstaller.cs b/src/umbraco.datalayer/SqlHelpers/SqlServer/SqlServerInstaller.cs index df163a742a..3f9dda0236 100644 --- a/src/umbraco.datalayer/SqlHelpers/SqlServer/SqlServerInstaller.cs +++ b/src/umbraco.datalayer/SqlHelpers/SqlServer/SqlServerInstaller.cs @@ -24,8 +24,10 @@ 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 * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'cmsContentType2ContentType'", 1, DatabaseVersion.Version4_9), + //This will throw an exception and will only ever have one row if it is installed, on exception the database version returned is unkown so will still work. + //NOTE: before this was set to zero and only worked by fluke! + new VersionSpecs("SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS LEFT OUTER JOIN umbracoApp ON appAlias = appAlias WHERE CONSTRAINT_NAME = 'FK_umbracoUser2app_umbracoApp'", 1, DatabaseVersion.Version4_8), new VersionSpecs("SELECT id FROM umbracoNode WHERE id = -21", 1, DatabaseVersion.Version4_1), new VersionSpecs("SELECT action FROM umbracoAppTree", DatabaseVersion.Version4), new VersionSpecs("SELECT description FROM cmsContentType", DatabaseVersion.Version3),