From dbce36b7a5cdb3f8c938dd662c48dd7d384f71e2 Mon Sep 17 00:00:00 2001 From: Morten Christensen Date: Wed, 26 Dec 2012 14:44:42 -0100 Subject: [PATCH] Adding migrations for v6 upgrades. Updating and testing migrations. --- .../Models/Rdbms/StylesheetDto.cs | 2 +- .../ConstraintDefinition.cs | 1 + .../ConstraintType.cs | 3 +- .../Persistence/Migrations/MigrationBase.cs | 6 + .../Persistence/Migrations/MigrationRunner.cs | 39 +- .../Migrations/Syntax/Create/CreateBuilder.cs | 8 + .../Expressions/CreateConstraintExpression.cs | 8 +- .../ForeignKey/CreateForeignKeyBuilder.cs | 2 +- .../ICreateForeignKeyToTableSyntax.cs | 2 +- .../Syntax/Execute/ExecuteBuilder.cs | 20 + .../ExecuteSqlStatementExpression.cs | 12 + .../Syntax/Execute/IExecuteBuilder.cs | 7 + .../Expressions/CreateColumnExpression.cs | 2 + .../RemoveUmbracoAppConstraints.cs | 24 + .../TargetVersionSixth/DeleteAppTables.cs | 17 + .../EnsureAppsTreesUpdated.cs | 24 + .../MoveMasterContentTypeData.cs | 16 + .../NewCmsContentType2ContentTypeTable.cs | 24 + .../RemoveMasterContentTypeColumn.cs | 22 + .../TargetVersionSixth/RenameCmsTabTable.cs | 16 + .../TargetVersionSixth/RenameTabIdColumn.cs | 16 + ...teCmsContentTypeAllowedContentTypeTable.cs | 16 + .../UpdateCmsContentTypeTable.cs | 20 + .../UpdateCmsContentVersionTable.cs | 16 + .../UpdateCmsPropertyTypeGroupTable.cs | 29 + .../SqlSyntax/ISqlSyntaxProvider.cs | 1 + .../SqlSyntax/MySqlSyntaxProvider.cs | 5 + .../SqlSyntax/SqlCeSyntaxProvider.cs | 31 + .../SqlSyntax/SqlSyntaxProviderBase.cs | 5 + src/Umbraco.Core/Umbraco.Core.csproj | 15 + .../Migrations/SqlCeUpgradeTest.cs | 136 ++ .../Migrations/SqlScripts/MySqlTotal-480.sql | 831 ++++++++ .../Migrations/SqlScripts/SqlCeTotal-480.sql | 645 +++++++ .../SqlScripts/SqlResources.Designer.cs | 138 ++ .../Migrations/SqlScripts/SqlResources.resx | 130 ++ .../SqlScripts/SqlServerTotal-480.sql | 1681 +++++++++++++++++ .../TargetVersionSixthMigrationsTest.cs | 70 + .../TestHelpers/BaseDatabaseTest.cs | 4 +- src/Umbraco.Tests/Umbraco.Tests.csproj | 17 +- .../EnsureAppsTreesUpdatedOnUpgrade.cs | 25 + src/Umbraco.Web/Umbraco.Web.csproj | 5 +- 41 files changed, 4072 insertions(+), 19 deletions(-) create mode 100644 src/Umbraco.Core/Persistence/Migrations/Syntax/Execute/ExecuteBuilder.cs create mode 100644 src/Umbraco.Core/Persistence/Migrations/Syntax/Execute/Expressions/ExecuteSqlStatementExpression.cs create mode 100644 src/Umbraco.Core/Persistence/Migrations/Syntax/Execute/IExecuteBuilder.cs create mode 100644 src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionFourEightZero/RemoveUmbracoAppConstraints.cs create mode 100644 src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/DeleteAppTables.cs create mode 100644 src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/EnsureAppsTreesUpdated.cs create mode 100644 src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/MoveMasterContentTypeData.cs create mode 100644 src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/NewCmsContentType2ContentTypeTable.cs create mode 100644 src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/RemoveMasterContentTypeColumn.cs create mode 100644 src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/RenameCmsTabTable.cs create mode 100644 src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/RenameTabIdColumn.cs create mode 100644 src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/UpdateCmsContentTypeAllowedContentTypeTable.cs create mode 100644 src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/UpdateCmsContentTypeTable.cs create mode 100644 src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/UpdateCmsContentVersionTable.cs create mode 100644 src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/UpdateCmsPropertyTypeGroupTable.cs create mode 100644 src/Umbraco.Tests/Migrations/SqlCeUpgradeTest.cs create mode 100644 src/Umbraco.Tests/Migrations/SqlScripts/MySqlTotal-480.sql create mode 100644 src/Umbraco.Tests/Migrations/SqlScripts/SqlCeTotal-480.sql create mode 100644 src/Umbraco.Tests/Migrations/SqlScripts/SqlResources.Designer.cs create mode 100644 src/Umbraco.Tests/Migrations/SqlScripts/SqlResources.resx create mode 100644 src/Umbraco.Tests/Migrations/SqlScripts/SqlServerTotal-480.sql create mode 100644 src/Umbraco.Tests/Migrations/TargetVersionSixthMigrationsTest.cs create mode 100644 src/Umbraco.Web/Strategies/EnsureAppsTreesUpdatedOnUpgrade.cs diff --git a/src/Umbraco.Core/Models/Rdbms/StylesheetDto.cs b/src/Umbraco.Core/Models/Rdbms/StylesheetDto.cs index 23ba061b9b..3580fcf918 100644 --- a/src/Umbraco.Core/Models/Rdbms/StylesheetDto.cs +++ b/src/Umbraco.Core/Models/Rdbms/StylesheetDto.cs @@ -6,7 +6,7 @@ namespace Umbraco.Core.Models.Rdbms [TableName("cmsStylesheet")] [PrimaryKey("nodeId", autoIncrement = false)] [ExplicitColumns] - public class StylesheetDto + internal class StylesheetDto { [Column("nodeId")] [PrimaryKeyColumn(AutoIncrement = false)] diff --git a/src/Umbraco.Core/Persistence/DatabaseModelDefinitions/ConstraintDefinition.cs b/src/Umbraco.Core/Persistence/DatabaseModelDefinitions/ConstraintDefinition.cs index e11febaaa7..a3b7d99802 100644 --- a/src/Umbraco.Core/Persistence/DatabaseModelDefinitions/ConstraintDefinition.cs +++ b/src/Umbraco.Core/Persistence/DatabaseModelDefinitions/ConstraintDefinition.cs @@ -12,6 +12,7 @@ namespace Umbraco.Core.Persistence.DatabaseModelDefinitions private ConstraintType constraintType; public bool IsPrimaryKeyConstraint { get { return ConstraintType.PrimaryKey == constraintType; } } public bool IsUniqueConstraint { get { return ConstraintType.Unique == constraintType; } } + public bool IsNonUniqueConstraint { get { return ConstraintType.NonUnique == constraintType; } } public string SchemaName { get; set; } public string ConstraintName { get; set; } diff --git a/src/Umbraco.Core/Persistence/DatabaseModelDefinitions/ConstraintType.cs b/src/Umbraco.Core/Persistence/DatabaseModelDefinitions/ConstraintType.cs index ff65c050f6..63d979ecb4 100644 --- a/src/Umbraco.Core/Persistence/DatabaseModelDefinitions/ConstraintType.cs +++ b/src/Umbraco.Core/Persistence/DatabaseModelDefinitions/ConstraintType.cs @@ -3,6 +3,7 @@ namespace Umbraco.Core.Persistence.DatabaseModelDefinitions public enum ConstraintType { PrimaryKey, - Unique + Unique, + NonUnique } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/MigrationBase.cs b/src/Umbraco.Core/Persistence/Migrations/MigrationBase.cs index 4334bc307b..f6a54b326b 100644 --- a/src/Umbraco.Core/Persistence/Migrations/MigrationBase.cs +++ b/src/Umbraco.Core/Persistence/Migrations/MigrationBase.cs @@ -1,6 +1,7 @@ using Umbraco.Core.Persistence.Migrations.Syntax.Alter; using Umbraco.Core.Persistence.Migrations.Syntax.Create; using Umbraco.Core.Persistence.Migrations.Syntax.Delete; +using Umbraco.Core.Persistence.Migrations.Syntax.Execute; using Umbraco.Core.Persistence.Migrations.Syntax.Insert; using Umbraco.Core.Persistence.Migrations.Syntax.Rename; using Umbraco.Core.Persistence.Migrations.Syntax.Update; @@ -41,6 +42,11 @@ namespace Umbraco.Core.Persistence.Migrations get { return new DeleteBuilder(_context); } } + public IExecuteBuilder Execute + { + get { return new ExecuteBuilder(_context); } + } + public IInsertBuilder Insert { get { return new InsertBuilder(_context); } diff --git a/src/Umbraco.Core/Persistence/Migrations/MigrationRunner.cs b/src/Umbraco.Core/Persistence/Migrations/MigrationRunner.cs index c0c0cd08a2..098b5272b3 100644 --- a/src/Umbraco.Core/Persistence/Migrations/MigrationRunner.cs +++ b/src/Umbraco.Core/Persistence/Migrations/MigrationRunner.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using Umbraco.Core.Logging; @@ -30,13 +31,9 @@ namespace Umbraco.Core.Persistence.Migrations LogHelper.Info("Initializing database migration"); var foundMigrations = PluginManager.Current.FindMigrations(); - var migrations = (from migration in foundMigrations - let migrationAttribute = migration.GetType().FirstAttribute() - where migrationAttribute != null - where - migrationAttribute.TargetVersion > _configuredVersion && - migrationAttribute.TargetVersion <= _targetVersion - select migration); + var migrations = isUpgrade + ? OrderedUpgradeMigrations(foundMigrations) + : OrderedDowngradeMigrations(foundMigrations); //Loop through migrations to generate sql var context = new MigrationContext(); @@ -52,7 +49,7 @@ namespace Umbraco.Core.Persistence.Migrations } } - //Transactional execution of the sql that was generated from the found migrationsS + //Transactional execution of the sql that was generated from the found migrations using (Transaction transaction = database.GetTransaction()) { foreach (var expression in context.Expressions) @@ -67,5 +64,31 @@ namespace Umbraco.Core.Persistence.Migrations return true; } + + internal IEnumerable OrderedUpgradeMigrations(IEnumerable foundMigrations) + { + var migrations = (from migration in foundMigrations + let migrationAttribute = migration.GetType().FirstAttribute() + where migrationAttribute != null + where + migrationAttribute.TargetVersion > _configuredVersion && + migrationAttribute.TargetVersion <= _targetVersion + orderby migrationAttribute.SortOrder ascending + select migration); + return migrations; + } + + public IEnumerable OrderedDowngradeMigrations(IEnumerable foundMigrations) + { + var migrations = (from migration in foundMigrations + let migrationAttribute = migration.GetType().FirstAttribute() + where migrationAttribute != null + where + migrationAttribute.TargetVersion > _configuredVersion && + migrationAttribute.TargetVersion <= _targetVersion + orderby migrationAttribute.SortOrder descending + select migration); + return migrations; + } } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/CreateBuilder.cs b/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/CreateBuilder.cs index f37626c98d..4e1595b1b5 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/CreateBuilder.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/CreateBuilder.cs @@ -89,5 +89,13 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create _context.Expressions.Add(expression); return new CreateConstraintBuilder(expression); } + + public ICreateConstraintOnTableSyntax Constraint(string constraintName) + { + var expression = new CreateConstraintExpression(ConstraintType.NonUnique); + expression.Constraint.ConstraintName = constraintName; + _context.Expressions.Add(expression); + return new CreateConstraintBuilder(expression); + } } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/Expressions/CreateConstraintExpression.cs b/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/Expressions/CreateConstraintExpression.cs index e2d1b0c6e6..011ff83146 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/Expressions/CreateConstraintExpression.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/Expressions/CreateConstraintExpression.cs @@ -17,7 +17,13 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Expressions { var constraintType = (Constraint.IsPrimaryKeyConstraint) ? "PRIMARY KEY" : "UNIQUE"; - string[] columns = new string[Constraint.Columns.Count]; + if (Constraint.IsPrimaryKeyConstraint && SyntaxConfig.SqlSyntaxProvider.SupportsClustered()) + constraintType += " CLUSTERED"; + + if (Constraint.IsNonUniqueConstraint) + constraintType = string.Empty; + + var columns = new string[Constraint.Columns.Count]; for (int i = 0; i < Constraint.Columns.Count; i++) { diff --git a/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/ForeignKey/CreateForeignKeyBuilder.cs b/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/ForeignKey/CreateForeignKeyBuilder.cs index c8ce249ce2..73fcb9571f 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/ForeignKey/CreateForeignKeyBuilder.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/ForeignKey/CreateForeignKeyBuilder.cs @@ -33,7 +33,7 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.ForeignKey return this; } - public ICreateForeignKeyForeignColumnSyntax ToTable(string table) + public ICreateForeignKeyPrimaryColumnSyntax ToTable(string table) { Expression.ForeignKey.PrimaryTable = table; return this; diff --git a/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/ForeignKey/ICreateForeignKeyToTableSyntax.cs b/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/ForeignKey/ICreateForeignKeyToTableSyntax.cs index 47767c4db4..ea2589a2c2 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/ForeignKey/ICreateForeignKeyToTableSyntax.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/ForeignKey/ICreateForeignKeyToTableSyntax.cs @@ -2,6 +2,6 @@ { public interface ICreateForeignKeyToTableSyntax : IFluentSyntax { - ICreateForeignKeyForeignColumnSyntax ToTable(string table); + ICreateForeignKeyPrimaryColumnSyntax ToTable(string table); } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Syntax/Execute/ExecuteBuilder.cs b/src/Umbraco.Core/Persistence/Migrations/Syntax/Execute/ExecuteBuilder.cs new file mode 100644 index 0000000000..b51646c064 --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Syntax/Execute/ExecuteBuilder.cs @@ -0,0 +1,20 @@ +using Umbraco.Core.Persistence.Migrations.Syntax.Execute.Expressions; + +namespace Umbraco.Core.Persistence.Migrations.Syntax.Execute +{ + public class ExecuteBuilder : IExecuteBuilder + { + private readonly IMigrationContext _context; + + public ExecuteBuilder(IMigrationContext context) + { + _context = context; + } + + public void Sql(string sqlStatement) + { + var expression = new ExecuteSqlStatementExpression {SqlStatement = sqlStatement}; + _context.Expressions.Add(expression); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Syntax/Execute/Expressions/ExecuteSqlStatementExpression.cs b/src/Umbraco.Core/Persistence/Migrations/Syntax/Execute/Expressions/ExecuteSqlStatementExpression.cs new file mode 100644 index 0000000000..ce679805f9 --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Syntax/Execute/Expressions/ExecuteSqlStatementExpression.cs @@ -0,0 +1,12 @@ +namespace Umbraco.Core.Persistence.Migrations.Syntax.Execute.Expressions +{ + public class ExecuteSqlStatementExpression : IMigrationExpression + { + public virtual string SqlStatement { get; set; } + + public override string ToString() + { + return SqlStatement; + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Syntax/Execute/IExecuteBuilder.cs b/src/Umbraco.Core/Persistence/Migrations/Syntax/Execute/IExecuteBuilder.cs new file mode 100644 index 0000000000..47a25cf0e3 --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Syntax/Execute/IExecuteBuilder.cs @@ -0,0 +1,7 @@ +namespace Umbraco.Core.Persistence.Migrations.Syntax.Execute +{ + public interface IExecuteBuilder : IFluentSyntax + { + void Sql(string sqlStatement); + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Syntax/Expressions/CreateColumnExpression.cs b/src/Umbraco.Core/Persistence/Migrations/Syntax/Expressions/CreateColumnExpression.cs index 31fa681340..10ab641cf8 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Syntax/Expressions/CreateColumnExpression.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Syntax/Expressions/CreateColumnExpression.cs @@ -16,6 +16,8 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Expressions public override string ToString() { + if (string.IsNullOrEmpty(Column.TableName)) + Column.TableName = TableName; return string.Format(SyntaxConfig.SqlSyntaxProvider.AddColumn, SyntaxConfig.SqlSyntaxProvider.GetQuotedTableName(TableName), diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionFourEightZero/RemoveUmbracoAppConstraints.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionFourEightZero/RemoveUmbracoAppConstraints.cs new file mode 100644 index 0000000000..ecc6c06347 --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionFourEightZero/RemoveUmbracoAppConstraints.cs @@ -0,0 +1,24 @@ +using System.Data; + +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionFourEightZero +{ + [MigrationAttribute("4.8.0", 0)] + public class RemoveUmbracoAppConstraints : MigrationBase + { + public override void Up() + { + Delete.ForeignKey("FK_umbracoUser2app_umbracoApp").OnTable("umbracoUser2app"); + + Delete.ForeignKey("FK_umbracoAppTree_umbracoApp").OnTable("umbracoAppTree"); + } + + public override void Down() + { + Create.ForeignKey("FK_umbracoUser2app_umbracoApp").FromTable("umbracoUser2app").ForeignColumn("app") + .ToTable("umbracoApp").PrimaryColumn("appAlias").OnDeleteOrUpdate(Rule.None); + + Create.ForeignKey("FK_umbracoAppTree_umbracoApp").FromTable("umbracoAppTree").ForeignColumn("appAlias") + .ToTable("umbracoApp").PrimaryColumn("appAlias").OnDeleteOrUpdate(Rule.None); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/DeleteAppTables.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/DeleteAppTables.cs new file mode 100644 index 0000000000..afc25de1ef --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/DeleteAppTables.cs @@ -0,0 +1,17 @@ +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixth +{ + [MigrationAttribute("6.0.0", 10)] + public class DeleteAppTables : MigrationBase + { + public override void Up() + { + Delete.Table("umbracoAppTree"); + + Delete.Table("umbracoApp"); + } + + public override void Down() + { + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/EnsureAppsTreesUpdated.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/EnsureAppsTreesUpdated.cs new file mode 100644 index 0000000000..46cc68981d --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/EnsureAppsTreesUpdated.cs @@ -0,0 +1,24 @@ +using System; + +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixth +{ + [MigrationAttribute("6.0.0", 9)] + public class EnsureAppsTreesUpdated : MigrationBase + { + public override void Up() + { + var e = new UpgradingEventArgs(); + + if (Upgrading != null) + Upgrading(this, e); + } + + public override void Down() + { + } + + public static event EventHandler Upgrading; + + public class UpgradingEventArgs : EventArgs{} + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/MoveMasterContentTypeData.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/MoveMasterContentTypeData.cs new file mode 100644 index 0000000000..f75abfb65e --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/MoveMasterContentTypeData.cs @@ -0,0 +1,16 @@ +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixth +{ + [MigrationAttribute("6.0.0", 5)] + public class MoveMasterContentTypeData : MigrationBase + { + public override void Up() + { + Execute.Sql( + "INSERT INTO [cmsContentType2ContentType] (parentContentTypeId, childContentTypeId) SELECT masterContentType, nodeId FROM [cmsContentType] WHERE not [masterContentType] is null and [masterContentType] != 0"); + } + + public override void Down() + { + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/NewCmsContentType2ContentTypeTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/NewCmsContentType2ContentTypeTable.cs new file mode 100644 index 0000000000..20c301f0c6 --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/NewCmsContentType2ContentTypeTable.cs @@ -0,0 +1,24 @@ +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixth +{ + [MigrationAttribute("6.0.0", 4)] + public class NewCmsContentType2ContentTypeTable : MigrationBase + { + public override void Up() + { + Create.Table("cmsContentType2ContentType") + .WithColumn("parentContentTypeId").AsInt16().NotNullable() + .WithColumn("childContentTypeId").AsInt16().NotNullable(); + + Create.PrimaryKey("PK_cmsContentType2ContentType") + .OnTable("cmsContentType2ContentType") + .Columns(new[] {"parentContentTypeId", "childContentTypeId"}); + } + + public override void Down() + { + Delete.PrimaryKey("PK_cmsContentType2ContentType").FromTable("cmsContentType2ContentType"); + + Delete.Table("cmsContentType2ContentType"); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/RemoveMasterContentTypeColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/RemoveMasterContentTypeColumn.cs new file mode 100644 index 0000000000..3741a945f1 --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/RemoveMasterContentTypeColumn.cs @@ -0,0 +1,22 @@ +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixth +{ + [MigrationAttribute("6.0.0", 6)] + public class RemoveMasterContentTypeColumn : MigrationBase + { + public override void Up() + { + //NOTE Don't think we can remove this column yet as it seems to be used by some starterkits + //Delete.UniqueConstraint("DF_cmsContentType_masterContentType").FromTable("cmsContentType"); + Delete.DefaultConstraint().OnTable("cmsContentType").OnColumn("masterContentType"); + + Delete.Column("masterContentType").FromTable("cmsContentType"); + } + + public override void Down() + { + Create.UniqueConstraint("DF_cmsContentType_masterContentType").OnTable("cmsContentType").Column("masterContentType"); + + Create.Column("masterContentType").OnTable("cmsContentType").AsInt16().Nullable().WithDefaultValue(0); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/RenameCmsTabTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/RenameCmsTabTable.cs new file mode 100644 index 0000000000..bf52c3c090 --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/RenameCmsTabTable.cs @@ -0,0 +1,16 @@ +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixth +{ + [MigrationAttribute("6.0.0", 0)] + public class RenameCmsTabTable : MigrationBase + { + public override void Up() + { + Rename.Table("cmsTab").To("cmsPropertyTypeGroup"); + } + + public override void Down() + { + Rename.Table("cmsPropertyTypeGroup").To("cmsTab"); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/RenameTabIdColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/RenameTabIdColumn.cs new file mode 100644 index 0000000000..7a07df5842 --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/RenameTabIdColumn.cs @@ -0,0 +1,16 @@ +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixth +{ + [MigrationAttribute("6.0.0", 7)] + public class RenameTabIdColumn : MigrationBase + { + public override void Up() + { + Rename.Column("tabId").OnTable("cmsPropertyType").To("propertyTypeGroupId"); + } + + public override void Down() + { + Rename.Column("propertyTypeGroupId").OnTable("cmsPropertyType").To("tabId"); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/UpdateCmsContentTypeAllowedContentTypeTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/UpdateCmsContentTypeAllowedContentTypeTable.cs new file mode 100644 index 0000000000..901e8b5613 --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/UpdateCmsContentTypeAllowedContentTypeTable.cs @@ -0,0 +1,16 @@ +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixth +{ + [MigrationAttribute("6.0.0", 3)] + public class UpdateCmsContentTypeAllowedContentTypeTable : MigrationBase + { + public override void Up() + { + Alter.Table("cmsContentTypeAllowedContentType").AddColumn("sortOrder").AsInt16().NotNullable().WithDefaultValue(1); + } + + public override void Down() + { + Delete.Column("sortOrder").FromTable("cmsContentTypeAllowedContentType"); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/UpdateCmsContentTypeTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/UpdateCmsContentTypeTable.cs new file mode 100644 index 0000000000..a7dd07f38e --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/UpdateCmsContentTypeTable.cs @@ -0,0 +1,20 @@ +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixth +{ + [MigrationAttribute("6.0.0", 2)] + public class UpdateCmsContentTypeTable : MigrationBase + { + public override void Up() + { + Alter.Table("cmsContentType").AddColumn("isContainer").AsBoolean().NotNullable().WithDefaultValue(0); + + Alter.Table("cmsContentType").AddColumn("allowAtRoot").AsBoolean().NotNullable().WithDefaultValue(0); + } + + public override void Down() + { + Delete.Column("allowAtRoot").FromTable("cmsContentType"); + + Delete.Column("isContainer").FromTable("cmsContentType"); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/UpdateCmsContentVersionTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/UpdateCmsContentVersionTable.cs new file mode 100644 index 0000000000..4ba6286215 --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/UpdateCmsContentVersionTable.cs @@ -0,0 +1,16 @@ +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixth +{ + [MigrationAttribute("6.0.0", 8)] + public class UpdateCmsContentVersionTable : MigrationBase + { + public override void Up() + { + Alter.Table("cmsContentVersion").AddColumn("LanguageLocale").AsString(10).Nullable(); + } + + public override void Down() + { + Delete.Column("LanguageLocale").FromTable("cmsContentVersion"); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/UpdateCmsPropertyTypeGroupTable.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/UpdateCmsPropertyTypeGroupTable.cs new file mode 100644 index 0000000000..1e89861938 --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixth/UpdateCmsPropertyTypeGroupTable.cs @@ -0,0 +1,29 @@ +using System.Data; + +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixth +{ + [MigrationAttribute("6.0.0", 1)] + public class UpdateCmsPropertyTypeGroupTable : MigrationBase + { + public override void Up() + { + Alter.Table("cmsPropertyTypeGroup").AddColumn("parentGroupId").AsInt16().Nullable(); + + Create.UniqueConstraint("df_cmsPropertyTypeGroup_parentGroupId") + .OnTable("cmsPropertyTypeGroup").Column("parentGroupId"); + + Create.ForeignKey("FK_cmsPropertyTypeGroup_cmsPropertyTypeGroup") + .FromTable("cmsPropertyTypeGroup").ForeignColumn("parentGroupId") + .ToTable("cmsPropertyTypeGroup").PrimaryColumn("id").OnDeleteOrUpdate(Rule.None); + } + + public override void Down() + { + Delete.ForeignKey("FK_cmsPropertyTypeGroup_cmsPropertyTypeGroup").OnTable("cmsPropertyTypeGroup"); + + Delete.UniqueConstraint("df_cmsPropertyTypeGroup_parentGroupId").FromTable("cmsPropertyTypeGroup"); + + Delete.Column("parentGroupId").FromTable("cmsPropertyTypeGroup"); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/SqlSyntax/ISqlSyntaxProvider.cs b/src/Umbraco.Core/Persistence/SqlSyntax/ISqlSyntaxProvider.cs index b59bcf3ec8..f98218f159 100644 --- a/src/Umbraco.Core/Persistence/SqlSyntax/ISqlSyntaxProvider.cs +++ b/src/Umbraco.Core/Persistence/SqlSyntax/ISqlSyntaxProvider.cs @@ -45,5 +45,6 @@ namespace Umbraco.Core.Persistence.SqlSyntax string Format(ForeignKeyDefinition foreignKey); string FormatColumnRename(string tableName, string oldName, string newName); string FormatTableRename(string oldName, string newName); + bool SupportsClustered(); } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/SqlSyntax/MySqlSyntaxProvider.cs b/src/Umbraco.Core/Persistence/SqlSyntax/MySqlSyntaxProvider.cs index a17b2339e3..32236bc667 100644 --- a/src/Umbraco.Core/Persistence/SqlSyntax/MySqlSyntaxProvider.cs +++ b/src/Umbraco.Core/Persistence/SqlSyntax/MySqlSyntaxProvider.cs @@ -92,6 +92,11 @@ namespace Umbraco.Core.Persistence.SqlSyntax return result > 0; } + public override bool SupportsClustered() + { + return false; + } + protected override string FormatIdentity(ColumnDefinition column) { return column.IsIdentity ? AutoIncrementDefinition : string.Empty; diff --git a/src/Umbraco.Core/Persistence/SqlSyntax/SqlCeSyntaxProvider.cs b/src/Umbraco.Core/Persistence/SqlSyntax/SqlCeSyntaxProvider.cs index 6fb5a123c5..b3947f4f8a 100644 --- a/src/Umbraco.Core/Persistence/SqlSyntax/SqlCeSyntaxProvider.cs +++ b/src/Umbraco.Core/Persistence/SqlSyntax/SqlCeSyntaxProvider.cs @@ -1,4 +1,5 @@ using System.Linq; +using System.Text; using Umbraco.Core.Persistence.DatabaseAnnotations; using Umbraco.Core.Persistence.DatabaseModelDefinitions; @@ -36,6 +37,11 @@ namespace Umbraco.Core.Persistence.SqlSyntax InitColumnTypeMap(); } + public override bool SupportsClustered() + { + return false; + } + public override string GetIndexType(IndexTypes indexTypes) { string indexType; @@ -68,6 +74,21 @@ namespace Umbraco.Core.Persistence.SqlSyntax return string.Format("[{0}]", name); } + public override string FormatColumnRename(string tableName, string oldName, string newName) + { + var sb = new StringBuilder(); + //http://stackoverflow.com/questions/3967353/microsoft-sql-compact-edition-rename-column + //Create new column + sb.AppendFormat("UPDATE {0} SET {1} = {2}", tableName, newName, oldName); + //Delete old column + return sb.ToString(); + } + + public override string FormatTableRename(string oldName, string newName) + { + return string.Format(RenameTable, oldName, newName); + } + public override string FormatPrimaryKey(TableDefinition table) { var columnDefinition = table.Columns.FirstOrDefault(x => x.IsPrimaryKey); @@ -128,8 +149,18 @@ namespace Umbraco.Core.Persistence.SqlSyntax return null; } + public override string DeleteDefaultConstraint + { + get + { + return "ALTER TABLE {0} ALTER COLUMN {1} DROP DEFAULT"; + } + } + public override string AddColumn { get { return "ALTER TABLE {0} ADD {1}"; } } public override string DropIndex { get { return "DROP INDEX {1}.{0}"; } } + + public override string RenameTable { get { return "sp_rename '{0}', '{1}'"; } } } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/SqlSyntax/SqlSyntaxProviderBase.cs b/src/Umbraco.Core/Persistence/SqlSyntax/SqlSyntaxProviderBase.cs index 15b84189a0..2eb3013ce2 100644 --- a/src/Umbraco.Core/Persistence/SqlSyntax/SqlSyntaxProviderBase.cs +++ b/src/Umbraco.Core/Persistence/SqlSyntax/SqlSyntaxProviderBase.cs @@ -156,6 +156,11 @@ namespace Umbraco.Core.Persistence.SqlSyntax return false; } + public virtual bool SupportsClustered() + { + return true; + } + public virtual string Format(TableDefinition table) { var statement = string.Format(CreateTable, GetQuotedTableName(table.Name), Format(table.Columns)); diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index b768e420e4..cd5b8baaad 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -331,6 +331,9 @@ + + + @@ -360,6 +363,18 @@ + + + + + + + + + + + + diff --git a/src/Umbraco.Tests/Migrations/SqlCeUpgradeTest.cs b/src/Umbraco.Tests/Migrations/SqlCeUpgradeTest.cs new file mode 100644 index 0000000000..2ea7151503 --- /dev/null +++ b/src/Umbraco.Tests/Migrations/SqlCeUpgradeTest.cs @@ -0,0 +1,136 @@ +using System; +using System.Configuration; +using System.Data.SqlServerCe; +using System.IO; +using System.Text.RegularExpressions; +using NUnit.Framework; +using SQLCE4Umbraco; +using Umbraco.Core; +using Umbraco.Core.Configuration; +using Umbraco.Core.ObjectResolution; +using Umbraco.Core.Persistence; +using Umbraco.Core.Persistence.Migrations; +using Umbraco.Core.Persistence.UnitOfWork; +using Umbraco.Core.Publishing; +using Umbraco.Core.Services; +using Umbraco.Tests.TestHelpers; + +namespace Umbraco.Tests.Migrations +{ + [TestFixture] + public class SqlCeUpgradeTest + { + /// Regular expression that finds multiline block comments. + private static readonly Regex m_findComments = new Regex(@"\/\*.*?\*\/", RegexOptions.Singleline | RegexOptions.Compiled); + + [SetUp] + public void Initialize() + { + TestHelper.SetupLog4NetForTests(); + TestHelper.InitializeContentDirectories(); + + string path = TestHelper.CurrentAssemblyDirectory; + AppDomain.CurrentDomain.SetData("DataDirectory", path); + + UmbracoSettings.UseLegacyXmlSchema = false; + + //this ensures its reset + PluginManager.Current = new PluginManager(false); + + //for testing, we'll specify which assemblies are scanned for the PluginTypeResolver + PluginManager.Current.AssembliesToScan = new[] + { + typeof (MigrationRunner).Assembly + }; + + RepositoryResolver.Current = new RepositoryResolver( + new RepositoryFactory()); + + //Delete database file before continueing + string filePath = string.Concat(path, "\\UmbracoPetaPocoTests.sdf"); + if (File.Exists(filePath)) + { + File.Delete(filePath); + } + + //Get the connectionstring settings from config + var settings = ConfigurationManager.ConnectionStrings["umbracoDbDsn"]; + ConfigurationManager.AppSettings.Set("umbracoDbDSN", @"datalayer=SQLCE4Umbraco.SqlCEHelper,SQLCE4Umbraco;data source=|DataDirectory|\UmbracoPetaPocoTests.sdf"); + + //Create the Sql CE database + var engine = new SqlCeEngine(settings.ConnectionString); + engine.CreateDatabase(); + + Resolution.Freeze(); + ApplicationContext.Current = new ApplicationContext( + //assign the db context + new DatabaseContext(new DefaultDatabaseFactory()), + //assign the service context + new ServiceContext(new PetaPocoUnitOfWorkProvider(), new FileUnitOfWorkProvider(), new PublishingStrategy())) { IsReady = true }; + + ApplicationContext.Current.DatabaseContext.Initialize(); + } + + [Test] + public void Can_Upgrade_From_470_To_600() + { + var configuredVersion = new Version("4.7.0"); + var targetVersion = new Version("6.0.0"); + var db = ApplicationContext.Current.DatabaseContext.Database; + + //Create db schema and data from old Total.sql file for Sql Ce + string statements = SqlScripts.SqlResources.SqlCeTotal_480; + // replace block comments by whitespace + statements = m_findComments.Replace(statements, " "); + // execute all non-empty statements + foreach (string statement in statements.Split(";".ToCharArray())) + { + string rawStatement = statement.Trim(); + if (rawStatement.Length > 0) + db.Execute(rawStatement); + } + + //Setup the MigrationRunner + var migrationRunner = new MigrationRunner(configuredVersion, targetVersion); + bool upgraded = migrationRunner.Execute(db, true); + + Assert.That(upgraded, Is.True); + + bool hasTabTable = db.TableExist("cmsTab"); + bool hasPropertyTypeGroupTable = db.TableExist("cmsPropertyTypeGroup"); + bool hasAppTreeTable = db.TableExist("umbracoAppTree"); + + Assert.That(hasTabTable, Is.False); + Assert.That(hasPropertyTypeGroupTable, Is.True); + Assert.That(hasAppTreeTable, Is.False); + } + + [TearDown] + public void TearDown() + { + ApplicationContext.Current.DatabaseContext.Database.Dispose(); + //reset the app context + ApplicationContext.Current.ApplicationCache.ClearAllCache(); + + //legacy API database connection close + SqlCeContextGuardian.CloseBackgroundConnection(); + + PluginManager.Current = null; + + ApplicationContext.Current = null; + Resolution.IsFrozen = false; + RepositoryResolver.Reset(); + + TestHelper.CleanContentDirectories(); + + string path = TestHelper.CurrentAssemblyDirectory; + AppDomain.CurrentDomain.SetData("DataDirectory", null); + + string filePath = string.Concat(path, "\\UmbracoPetaPocoTests.sdf"); + if (File.Exists(filePath)) + { + File.Delete(filePath); + } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Migrations/SqlScripts/MySqlTotal-480.sql b/src/Umbraco.Tests/Migrations/SqlScripts/MySqlTotal-480.sql new file mode 100644 index 0000000000..818a20babb --- /dev/null +++ b/src/Umbraco.Tests/Migrations/SqlScripts/MySqlTotal-480.sql @@ -0,0 +1,831 @@ +/******************************************************************************************* + + + + + + + + Umbraco database installation script for MySQL + +IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT + + Database version: 4.8.0.4 + + 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 Boost and Nitro installation; + * 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 + + + + + + + +********************************************************************************************/ + +CREATE TABLE umbracoRelation +( +id int NOT NULL AUTO_INCREMENT PRIMARY KEY, +parentId int NOT NULL, +childId int NOT NULL, +relType int NOT NULL, +datetime TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +comment nvarchar (1000) NOT NULL +) + +; +CREATE TABLE cmsDocument +( +nodeId int NOT NULL, +published bit NOT NULL, +documentUser int NOT NULL, +versionId CHAR(36) NOT NULL PRIMARY KEY, +text nvarchar (255) NOT NULL, +releaseDate datetime NULL, +expireDate datetime NULL, +updateDate TIMESTAMP ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP, +templateId int NULL, +alias nvarchar (255) NULL , +newest bit NOT NULL DEFAULT 0 +) + +; +CREATE TABLE umbracoLog +( +id int NOT NULL AUTO_INCREMENT PRIMARY KEY, +userId int NOT NULL, +NodeId int NOT NULL, +Datestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +logHeader nvarchar (50) NOT NULL, +logComment nvarchar (4000) NULL +) + +; +CREATE TABLE umbracoUserGroup +( +id smallint NOT NULL AUTO_INCREMENT PRIMARY KEY, +userGroupName nvarchar (255) NOT NULL +) + +; + +/* TABLE IS NEVER USED, REMOVED FOR 4.1 + +CREATE TABLE umbracoUser2userGroup +( +user int NOT NULL, +userGroup smallint NOT NULL +) +; +ALTER TABLE umbracoUser2userGroup ADD CONSTRAINT PK_user2userGroup PRIMARY KEY CLUSTERED (user, userGroup) +; + +*/ + +CREATE TABLE umbracoApp +( +sortOrder tinyint NOT NULL DEFAULT 0, +appAlias nvarchar (50) PRIMARY KEY NOT NULL, +appIcon nvarchar (255) NOT NULL, +appName nvarchar (255) NOT NULL, +appInitWithTreeAlias nvarchar (255) NULL +) + +; +CREATE TABLE cmsPropertyData +( +id int NOT NULL PRIMARY KEY AUTO_INCREMENT, +contentNodeId int NOT NULL, +versionId CHAR(36) NULL, +propertytypeid int NOT NULL, +dataInt int NULL, +dataDate datetime NULL, +dataNvarchar nvarchar (500) NULL, +dataNtext LONGTEXT NULL +) +; +CREATE INDEX IX_cmsPropertyData_1 ON cmsPropertyData (contentNodeId) +; +CREATE INDEX IX_cmsPropertyData_2 ON cmsPropertyData (versionId) +; +CREATE INDEX IX_cmsPropertyData_3 ON cmsPropertyData (propertytypeid) +; +CREATE TABLE cmsContent +( +pk int NOT NULL PRIMARY KEY AUTO_INCREMENT, +nodeId int NOT NULL, +contentType int NOT NULL +) + +; +CREATE TABLE cmsContentType +( +pk int NOT NULL PRIMARY KEY AUTO_INCREMENT, +nodeId int NOT NULL, +alias nvarchar (255) NULL, +icon nvarchar (255) NULL +) + +; +CREATE TABLE cmsMacroPropertyType +( +id smallint NOT NULL PRIMARY KEY AUTO_INCREMENT, +macroPropertyTypeAlias nvarchar (50) NULL, +macroPropertyTypeRenderAssembly nvarchar (255) NULL, +macroPropertyTypeRenderType nvarchar (255) NULL, +macroPropertyTypeBaseType nvarchar (255) NULL +) +; + +/* TABLE IS NEVER USED, REMOVED FOR 4.1 + +CREATE TABLE umbracoStylesheetProperty +( +id smallint NOT NULL PRIMARY KEY AUTO_INCREMENT, +stylesheetPropertyEditor bit NOT NULL DEFAULT 0, +stylesheet tinyint NOT NULL, +stylesheetPropertyAlias nvarchar (50) NULL, +stylesheetPropertyName nvarchar (255) NULL, +stylesheetPropertyValue nvarchar (400) NULL +) +; + +*/ + +CREATE TABLE cmsTab +( +id int NOT NULL PRIMARY KEY AUTO_INCREMENT, +contenttypeNodeId int NOT NULL, +text nvarchar (255) NOT NULL, +sortorder int NOT NULL +) + +; +CREATE TABLE cmsTemplate +( +pk int NOT NULL PRIMARY KEY AUTO_INCREMENT, +nodeId int NOT NULL, +master int NULL, +alias nvarchar (100) NULL, +design LONGTEXT NOT NULL +) + +; +CREATE TABLE umbracoUser2app +( +user int NOT NULL, +app nvarchar (50) NOT NULL +) + +; +ALTER TABLE umbracoUser2app ADD CONSTRAINT PK_user2app PRIMARY KEY CLUSTERED (user, app) +; +CREATE TABLE umbracoUserType +( +id smallint NOT NULL PRIMARY KEY AUTO_INCREMENT, +userTypeAlias nvarchar (50) NULL, +userTypeName nvarchar (255) NOT NULL, +userTypeDefaultPermissions nvarchar (50) NULL +) + +; +CREATE TABLE umbracoUser +( +id int NOT NULL PRIMARY KEY AUTO_INCREMENT, +userDisabled bit NOT NULL DEFAULT 0, +userNoConsole bit NOT NULL DEFAULT 0, +userType smallint NOT NULL, +startStructureID int NOT NULL, +startMediaID int NULL, +userName nvarchar (255) NOT NULL, +userLogin nvarchar (125) NOT NULL, +userPassword nvarchar (125) NOT NULL, +userEmail nvarchar (255) NOT NULL, +userDefaultPermissions nvarchar (50) NULL, +userLanguage nvarchar (10) NULL , +defaultToLiveEditing bit NOT NULL DEFAULT 0 +) + +; +CREATE TABLE cmsDocumentType +( +contentTypeNodeId int NOT NULL, +templateNodeId int NOT NULL, +IsDefault bit NOT NULL DEFAULT 0 +) + +; +ALTER TABLE cmsDocumentType ADD CONSTRAINT PK_cmsDocumentType PRIMARY KEY CLUSTERED (contentTypeNodeId, templateNodeId) +; +CREATE TABLE cmsMemberType +( +pk int NOT NULL PRIMARY KEY AUTO_INCREMENT, +NodeId int NOT NULL, +propertytypeId int NOT NULL, +memberCanEdit bit NOT NULL DEFAULT 0, +viewOnProfile bit NOT NULL DEFAULT 0 +) + +; +CREATE TABLE cmsMember +( +nodeId int NOT NULL, +Email nvarchar (1000) NOT NULL DEFAULT '', +LoginName nvarchar (1000) NOT NULL DEFAULT '', +Password nvarchar (1000) NOT NULL DEFAULT '' +) + +; +CREATE TABLE umbracoNode +( +id int NOT NULL PRIMARY KEY, +trashed bit NOT NULL DEFAULT 0, +parentID int NOT NULL, +nodeUser int NULL, +level smallint NOT NULL, +path nvarchar (150) NOT NULL, +sortOrder int NOT NULL, +uniqueID CHAR(36) NULL, +text nvarchar (255) NULL, +nodeObjectType CHAR(36) NULL, +createDate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +) + +; +CREATE INDEX IX_umbracoNodeParentId ON umbracoNode (parentID) +; +CREATE INDEX IX_umbracoNodeObjectType ON umbracoNode (nodeObjectType) +; +CREATE TABLE cmsPropertyType +( +id int NOT NULL PRIMARY KEY AUTO_INCREMENT, +dataTypeId int NOT NULL, +contentTypeId int NOT NULL, +tabId int NULL, +Alias nvarchar (255) NOT NULL, +Name nvarchar (255) NULL, +helpText nvarchar (1000) NULL, +sortOrder int NOT NULL DEFAULT 0, +mandatory bit NOT NULL DEFAULT 0, +validationRegExp nvarchar (255) NULL, +Description nvarchar (2000) NULL +) + +; +CREATE TABLE cmsMacroProperty +( +id int NOT NULL PRIMARY KEY AUTO_INCREMENT, +macroPropertyHidden bit NOT NULL DEFAULT 0, +macroPropertyType smallint NOT NULL, +macro int NOT NULL, +macroPropertySortOrder tinyint NOT NULL DEFAULT 0, +macroPropertyAlias nvarchar (50) NOT NULL, +macroPropertyName nvarchar (255) NOT NULL +) + +; +CREATE TABLE cmsMacro +( +id int NOT NULL PRIMARY KEY AUTO_INCREMENT, +macroUseInEditor bit NOT NULL DEFAULT 0, +macroRefreshRate int NOT NULL DEFAULT 0, +macroAlias nvarchar (255) NOT NULL, +macroName nvarchar (255) NULL, +macroScriptType nvarchar (255) NULL, +macroScriptAssembly nvarchar (255) NULL, +macroXSLT nvarchar (255) NULL, +macroCacheByPage bit NOT NULL DEFAULT 1, +macroCachePersonalized bit NOT NULL DEFAULT 0, +macroDontRender bit NOT NULL DEFAULT 0 +) + +; +CREATE TABLE cmsContentVersion +( +id int NOT NULL PRIMARY KEY AUTO_INCREMENT, +ContentId int NOT NULL, +VersionId CHAR(36) NOT NULL, +VersionDate TIMESTAMP DEFAULT CURRENT_TIMESTAMP +) + +; +CREATE TABLE umbracoAppTree +( +treeSilent bit NOT NULL DEFAULT 0, +treeInitialize bit NOT NULL DEFAULT 1, +treeSortOrder tinyint NOT NULL, +appAlias nvarchar (50) NOT NULL, +treeAlias nvarchar (150) NOT NULL, +treeTitle nvarchar (255) NOT NULL, +treeIconClosed nvarchar (255) NOT NULL, +treeIconOpen nvarchar (255) NOT NULL, +treeHandlerAssembly nvarchar (255) NOT NULL, +treeHandlerType nvarchar (255) NOT NULL, +action nvarchar (300) NULL +) + +; +ALTER TABLE umbracoAppTree ADD CONSTRAINT PK_umbracoAppTree PRIMARY KEY CLUSTERED (appAlias, treeAlias) +; +CREATE TABLE cmsContentTypeAllowedContentType +( +Id int NOT NULL, +AllowedId int NOT NULL +) + +; +ALTER TABLE cmsContentTypeAllowedContentType ADD CONSTRAINT PK_cmsContentTypeAllowedContentType PRIMARY KEY CLUSTERED (Id, AllowedId) +; +CREATE TABLE cmsContentXml +( +nodeId int NOT NULL PRIMARY KEY, +xml LONGTEXT NOT NULL +) + +; +CREATE TABLE cmsDataType +( +pk int NOT NULL PRIMARY KEY AUTO_INCREMENT PRIMARY KEY, +nodeId int NOT NULL, +controlId CHAR(36) NOT NULL, +dbType varchar (50) NOT NULL +) + +; +CREATE TABLE cmsDataTypePreValues +( +id int NOT NULL PRIMARY KEY AUTO_INCREMENT, +datatypeNodeId int NOT NULL, +value NVARCHAR(2500) NULL, +sortorder int NOT NULL, +alias nvarchar (50) NULL +) + +; +CREATE TABLE cmsDictionary +( +pk int NOT NULL PRIMARY KEY AUTO_INCREMENT, +id CHAR(36) NOT NULL, +parent CHAR(36) NOT NULL, +`key` nvarchar (1000) NOT NULL +) + +; +CREATE TABLE cmsLanguageText +( +pk int NOT NULL PRIMARY KEY AUTO_INCREMENT, +languageId int NOT NULL, +UniqueId CHAR(36) NOT NULL, +value nvarchar (1000) NOT NULL +) + +; +CREATE TABLE cmsMember2MemberGroup +( +Member int NOT NULL, +MemberGroup int NOT NULL +) + +; +ALTER TABLE cmsMember2MemberGroup ADD CONSTRAINT PK_cmsMember2MemberGroup PRIMARY KEY CLUSTERED (Member, MemberGroup) +; +CREATE TABLE cmsStylesheet +( +nodeId int NOT NULL, +filename nvarchar (100) NOT NULL, +content LONGTEXT NULL +) + +; +CREATE TABLE cmsStylesheetProperty +( +nodeId int NOT NULL, +stylesheetPropertyEditor bit NULL, +stylesheetPropertyAlias nvarchar (50) NULL, +stylesheetPropertyValue nvarchar (400) NULL +) + +; +CREATE TABLE umbracoDomains +( +id int NOT NULL PRIMARY KEY AUTO_INCREMENT, +domainDefaultLanguage int NULL, +domainRootStructureID int NULL, +domainName nvarchar (255) NOT NULL +) + +; +CREATE TABLE umbracoLanguage +( +id smallint NOT NULL PRIMARY KEY AUTO_INCREMENT, +languageISOCode nvarchar (10) NULL, +languageCultureName nvarchar (100) NULL +) + +; +CREATE TABLE umbracoRelationType +( +id int NOT NULL PRIMARY KEY AUTO_INCREMENT, +`dual` bit NOT NULL, +parentObjectType CHAR(36) NOT NULL, +childObjectType CHAR(36) NOT NULL, +name nvarchar (255) NOT NULL, +alias nvarchar (100) NULL +) +; + +/* TABLE IS NEVER USED, REMOVED FOR 4.1 + +CREATE TABLE umbracoStylesheet +( +nodeId int NOT NULL PRIMARY KEY, +filename nvarchar (100) NOT NULL, +content LONGTEXT NULL +) +; + +*/ + +CREATE TABLE umbracoUser2NodeNotify +( +userId int NOT NULL, +nodeId int NOT NULL, +action char (1) NOT NULL +) + +; +ALTER TABLE umbracoUser2NodeNotify ADD CONSTRAINT PK_umbracoUser2NodeNotify PRIMARY KEY CLUSTERED (userId, nodeId, action) +; +CREATE TABLE umbracoUser2NodePermission +( +userId int NOT NULL, +nodeId int NOT NULL, +permission char (1) NOT NULL +) + +; +ALTER TABLE umbracoUser2NodePermission ADD CONSTRAINT PK_umbracoUser2NodePermission PRIMARY KEY CLUSTERED (userId, nodeId, permission) +; +CREATE TABLE umbracoUserLogins +( +contextId CHAR(36) NOT NULL, +userID int NOT NULL, +timeout bigint NOT NULL +) + +; +INSERT INTO umbracoNode (id, trashed, parentID, nodeUser, level, path, sortOrder, uniqueID, text, nodeObjectType, createDate) VALUES + (-92, 0, -1, 0, 11, '-1,-92', 37, 'f0bc4bfb-b499-40d6-ba86-058885a5178c', 'Label', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2004/09/30 14:01:49.920'), + (-90, 0, -1, 0, 11, '-1,-90', 35, '84c6b441-31df-4ffe-b67e-67d5bc3ae65a', 'Upload', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2004/09/30 14:01:49.920'), + (-89, 0, -1, 0, 11, '-1,-89', 34, 'c6bac0dd-4ab9-45b1-8e30-e4b619ee5da3', 'Textbox multiple', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2004/09/30 14:01:49.920'), + (-88, 0, -1, 0, 11, '-1,-88', 33, '0cc0eba1-9960-42c9-bf9b-60e150b429ae', 'Textstring', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2004/09/30 14:01:49.920'), + (-87, 0, -1, 0, 11, '-1,-87', 32, 'ca90c950-0aff-4e72-b976-a30b1ac57dad', 'Richtext editor', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2004/09/30 14:01:49.920'), + (-51, 0, -1, 0, 11, '-1,-51', 4, '2e6d3631-066e-44b8-aec4-96f09099b2b5', 'Numeric', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2004/09/30 14:01:49.920'), + (-49, 0, -1, 0, 11, '-1,-49', 2, '92897bc6-a5f3-4ffe-ae27-f2e7e33dda49', 'True/false', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2004/09/30 14:01:49.920'), + (-43, 0, -1, 0, 1, '-1,-43', 2, 'fbaf13a8-4036-41f2-93a3-974f678c312a', 'Checkbox list', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2004/10/15 14:11:04.367'), + (-42, 0, -1, 0, 1, '-1,-42', 2, '0b6a45e7-44ba-430d-9da5-4e46060b9e03', 'Dropdow', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2004/10/15 14:10:59.000'), + (-41, 0, -1, 0, 1, '-1,-41', 2, '5046194e-4237-453c-a547-15db3a07c4e1', 'Date Picker', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2004/10/15 14:10:54.303'), + (-40, 0, -1, 0, 1, '-1,-40', 2, 'bb5f57c9-ce2b-4bb9-b697-4caca783a805', 'Radiobox', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2004/10/15 14:10:49.253'), + (-39, 0, -1, 0, 1, '-1,-39', 2, 'f38f0ac7-1d27-439c-9f3f-089cd8825a53', 'Dropdown multiple', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2004/10/15 14:10:44.480'), + (-38, 0, -1, 0, 1, '-1,-38', 2, 'fd9f1447-6c61-4a7c-9595-5aa39147d318', 'Folder Browser', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2004/10/15 14:10:37.020'), + (-37, 0, -1, 0, 1, '-1,-37', 2, '0225af17-b302-49cb-9176-b9f35cab9c17', 'Approved Color', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2004/10/15 14:10:30.580'), + (-36, 0, -1, 0, 1, '-1,-36', 2, 'e4d66c0f-b935-4200-81f0-025f7256b89a', 'Date Picker with time', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2004/10/15 14:10:23.007'), + (-20, 0, -1, 0, 0, '-1,-20', 0, '0F582A79-1E41-4CF0-BFA0-76340651891A', 'Recycle Bin', '01BB7FF2-24DC-4C0C-95A2-C24EF72BBAC8', '2004/09/30 14:01:49.920'), + (-1, 0, -1, 0, 0, '-1', 0, '916724a5-173d-4619-b97e-b9de133dd6f5', 'SYSTEM DATA: umbraco master root', 'ea7d8624-4cfe-4578-a871-24aa946bf34d', '2004/09/30 14:01:49.920'), + (1031, 0, -1, 1, 1, '-1,1031', 2, 'f38bd2d7-65d0-48e6-95dc-87ce06ec2d3d', 'Folder', '4ea4382b-2f5a-4c2b-9587-ae9b3cf3602e', '2004/12/01 00:13:40.743'), + (1032, 0, -1, 1, 1, '-1,1032', 2, 'cc07b313-0843-4aa8-bbda-871c8da728c8', 'Image', '4ea4382b-2f5a-4c2b-9587-ae9b3cf3602e', '2004/12/01 00:13:43.737'), + (1033, 0, -1, 1, 1, '-1,1033', 2, '4c52d8ab-54e6-40cd-999c-7a5f24903e4d', 'File', '4ea4382b-2f5a-4c2b-9587-ae9b3cf3602e', '2004/12/01 00:13:46.210'), + (1034, 0, -1, 0, 1, '-1,1034', 2, 'a6857c73-d6e9-480c-b6e6-f15f6ad11125', 'Content Picker', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2006/01/03 13:07:29.203'), + (1035, 0, -1, 0, 1, '-1,1035', 2, '93929b9a-93a2-4e2a-b239-d99334440a59', 'Media Picker', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2006/01/03 13:07:36.143'), + (1036, 0, -1, 0, 1, '-1,1036', 2, '2b24165f-9782-4aa3-b459-1de4a4d21f60', 'Member Picker', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2006/01/03 13:07:40.260'), + (1038, 0, -1, 0, 1, '-1,1038', 2, '1251c96c-185c-4e9b-93f4-b48205573cbd', 'Simple Editor', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2006/01/03 13:07:55.250'), + (1039, 0, -1, 0, 1, '-1,1039', 2, '06f349a9-c949-4b6a-8660-59c10451af42', 'Ultimate Picker', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2006/01/03 13:07:55.250'), + (1040, 0, -1, 0, 1, '-1,1040', 2, '21e798da-e06e-4eda-a511-ed257f78d4fa', 'Related Links', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2006/01/03 13:07:55.250'), + (1041, 0, -1, 0, 1, '-1,1041', 2, 'b6b73142-b9c1-4bf8-a16d-e1c23320b549', 'Tags', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2006/01/03 13:07:55.250'), + (1042, 0, -1, 0, 1, '-1,1042', 2, '0a452bd5-83f9-4bc3-8403-1286e13fb77e', 'Macro Container', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2006/01/03 13:07:55.250'), + (1043, 0, -1, 0, 1, '-1,1042', 2, '1df9f033-e6d4-451f-b8d2-e0cbc50a836f', 'Image Cropper', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '2006/01/03 13:07:55.250') +; + +INSERT INTO cmsContentType (pk, nodeId, alias, icon) VALUES + (532, 1031, 'Folder', 'folder.gif'), + (533, 1032, 'Image', 'mediaPhoto.gif'), + (534, 1033, 'File', 'mediaMulti.gif') +; +INSERT INTO umbracoUserType (id, userTypeAlias, userTypeName, userTypeDefaultPermissions) VALUES + (1, 'admin', 'Administrators', 'CADMOSKTPIURZ5:'), + (2, 'writer', 'Writer', 'CAH:'), + (3, 'editor', 'Editors', 'CADMOSKTPUZ5:'), + (4, 'translator', 'Translator', 'A') +; +INSERT INTO umbracoUser (id, userDisabled, userNoConsole, userType, startStructureID, startMediaID, userName, userLogin, userPassword, userEmail, userDefaultPermissions, userLanguage) VALUES (0, 0, 0, 1, -1, -1, 'Administrator', 'admin', 'default', '', NULL, 'en') +; +UPDATE umbracoUser SET id=0 WHERE id=1 AND userLogin='admin' +; +INSERT INTO umbracoApp (appAlias, sortOrder, appIcon, appName, appInitWithTreeAlias) VALUES + ('content', 0, '.traycontent', 'Indhold', 'content'), + ('developer', 7, '.traydeveloper', 'Developer', NULL), + ('media', 1, '.traymedia', 'Mediearkiv', NULL), + ('member', 8, '.traymember', 'Medlemmer', NULL), + ('settings', 6, '.traysettings', 'Indstillinger', NULL), + ('users', 5, '.trayusers', 'Brugere', NULL) +; +INSERT INTO umbracoUser2app (user, app) VALUES + (0, 'content'), + (0, 'developer'), + (0, 'media'), + (0, 'member'), + (0, 'settings'), + (0, 'users') +; +INSERT INTO umbracoAppTree (appAlias, treeAlias, treeSilent, treeInitialize, treeSortOrder, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) VALUES + ('content', 'content', 1, 1, 0, 'Indhold', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadContent'), + ('developer', 'cacheBrowser', 0, 1, 0, 'CacheBrowser', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadCache'), + ('developer', 'CacheItem', 0, 0, 0, 'Cachebrowser', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadCacheItem'), + ('developer', 'datatype', 0, 1, 1, 'Datatyper', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadDataTypes'), + ('developer', 'macros', 0, 1, 2, 'Macros', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadMacros'), + ('developer', 'xslt', 0, 1, 5, 'XSLT Files', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadXslt'), + + ('developer', 'packager', 0, 1, 3, 'Packages', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadPackager'), + ('developer', 'packagerPackages', 0, 0, 1, 'Packager Packages', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadPackages'), + + ('media', 'media', 0, 1, 0, 'Medier', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadMedia'), + ('member', 'member', 0, 1, 0, 'Medlemmer', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadMembers'), + ('member', 'memberGroup', 0, 1, 1, 'MemberGroups', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadMemberGroups'), + ('member', 'memberType', 0, 1, 2, 'Medlemstyper', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadMemberTypes'), + ('settings', 'languages', 0, 1, 4, 'Languages', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadLanguages'), + ('settings', 'mediaTypes', 0, 1, 5, 'Medietyper', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadMediaTypes'), + ('settings', 'nodeTypes', 0, 1, 6, 'Dokumenttyper', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadNodeTypes'), + ('settings', 'stylesheetProperty', 0, 0, 0, 'Stylesheet Property', '', '', 'umbraco', 'loadStylesheetProperty'), + ('settings', 'stylesheets', 0, 1, 0, 'Stylesheets', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadStylesheets'), + ('settings', 'templates', 0, 1, 1, 'Templates', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadTemplates'), + ('users', 'users', 0, 1, 0, 'Brugere', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadUsers') +; + +INSERT INTO umbracoAppTree (appAlias, treeAlias, treeSilent, treeInitialize, treeSortOrder, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType, action) VALUES + ('settings', 'dictionary', 0, 1, 3, 'Dictionary', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadDictionary','openDictionary()') +; + +INSERT INTO cmsMacroPropertyType (id, macroPropertyTypeAlias, macroPropertyTypeRenderAssembly, macroPropertyTypeRenderType, macroPropertyTypeBaseType) VALUES + (3, 'mediaCurrent', 'umbraco.macroRenderings', 'media', 'Int32'), + (4, 'contentSubs', 'umbraco.macroRenderings', 'content', 'Int32'), + (5, 'contentRandom', 'umbraco.macroRenderings', 'content', 'Int32'), + (6, 'contentPicker', 'umbraco.macroRenderings', 'content', 'Int32'), + (13, 'number', 'umbraco.macroRenderings', 'numeric', 'Int32'), + (14, 'bool', 'umbraco.macroRenderings', 'yesNo', 'Boolean'), + (16, 'text', 'umbraco.macroRenderings', 'text', 'String'), + (17, 'contentTree', 'umbraco.macroRenderings', 'content', 'Int32'), + (18, 'contentType', 'umbraco.macroRenderings', 'contentTypeSingle', 'Int32'), + (19, 'contentTypeMultiple', 'umbraco.macroRenderings', 'contentTypeMultiple', 'Int32'), + (20, 'contentAll', 'umbraco.macroRenderings', 'content', 'Int32'), + (21, 'tabPicker', 'umbraco.macroRenderings', 'tabPicker', 'String'), + (22, 'tabPickerMultiple', 'umbraco.macroRenderings', 'tabPickerMultiple', 'String'), + (23, 'propertyTypePicker', 'umbraco.macroRenderings', 'propertyTypePicker', 'String'), + (24, 'propertyTypePickerMultiple', 'umbraco.macroRenderings', 'propertyTypePickerMultiple', 'String'), + (25, 'textMultiLine', 'umbraco.macroRenderings', 'textMultiple', 'String') +; +INSERT INTO cmsTab (id, contenttypeNodeId, text, sortorder) VALUES + (3, 1032, 'Image', 1), + (4, 1033, 'File', 1), + (5, 1031, 'Contents', 1) +; +INSERT INTO cmsPropertyType (id, dataTypeId, contentTypeId, tabId, Alias, Name, helpText, sortOrder, mandatory, validationRegExp, Description) VALUES + (6, -90, 1032, 3, 'umbracoFile', 'Upload image', NULL, 0, 0, NULL, NULL), + (7, -92, 1032, 3, 'umbracoWidth', 'Width', NULL, 0, 0, NULL, NULL), + (8, -92, 1032, 3, 'umbracoHeight', 'Height', NULL, 0, 0, NULL, NULL), + (9, -92, 1032, 3, 'umbracoBytes', 'Size', NULL, 0, 0, NULL, NULL), + (10, -92, 1032, 3, 'umbracoExtension', 'Type', NULL, 0, 0, NULL, NULL), + (24, -90, 1033, 4, 'umbracoFile', 'Upload file', NULL, 0, 0, NULL, NULL), + (25, -92, 1033, 4, 'umbracoExtension', 'Type', NULL, 0, 0, NULL, NULL), + (26, -92, 1033, 4, 'umbracoBytes', 'Size', NULL, 0, 0, NULL, NULL), + (27, -38, 1031, 5, 'contents', 'Contents:', NULL, 0, 0, NULL, NULL) +; +INSERT INTO umbracoLanguage (id, languageISOCode, languageCultureName) VALUES (1, 'en-US', 'en-US') +; +INSERT INTO cmsContentTypeAllowedContentType (Id, AllowedId) VALUES (1031, 1031),(1031, 1032),(1031, 1033) +; +INSERT INTO cmsDataType (pk, nodeId, controlId, dbType) VALUES + (4, -49, '38b352c1-e9f8-4fd8-9324-9a2eab06d97a', 'Integer'), + (6, -51, '1413afcb-d19a-4173-8e9a-68288d2a73b8', 'Integer'), + (8, -87, '5E9B75AE-FACE-41c8-B47E-5F4B0FD82F83', 'Ntext'), + (9, -88, 'ec15c1e5-9d90-422a-aa52-4f7622c63bea', 'Nvarchar'), + (10, -89, '67db8357-ef57-493e-91ac-936d305e0f2a', 'Ntext'), + (11, -90, '5032a6e6-69e3-491d-bb28-cd31cd11086c', 'Nvarchar'), + (12, -91, 'a74ea9c9-8e18-4d2a-8cf6-73c6206c5da6', 'Nvarchar'), + (13, -92, '6c738306-4c17-4d88-b9bd-6546f3771597', 'Nvarchar'), + (14, -36, 'b6fb1622-afa5-4bbf-a3cc-d9672a442222', 'Date'), + (15, -37, 'f8d60f68-ec59-4974-b43b-c46eb5677985', 'Nvarchar'), + (16, -38, 'cccd4ae9-f399-4ed2-8038-2e88d19e810c', 'Nvarchar'), + (17, -39, '928639ed-9c73-4028-920c-1e55dbb68783', 'Nvarchar'), + (18, -40, 'a52c7c1c-c330-476e-8605-d63d3b84b6a6', 'Nvarchar'), + (19, -41, '23e93522-3200-44e2-9f29-e61a6fcbb79a', 'Date'), + (20, -42, 'a74ea9c9-8e18-4d2a-8cf6-73c6206c5da6', 'Integer'), + (21, -43, 'b4471851-82b6-4c75-afa4-39fa9c6a75e9', 'Nvarchar'), + (22, -44, 'a3776494-0574-4d93-b7de-efdfdec6f2d1', 'Ntext'), + (23, -128, 'a52c7c1c-c330-476e-8605-d63d3b84b6a6', 'Nvarchar'), + (24, -129, '928639ed-9c73-4028-920c-1e55dbb68783', 'Nvarchar'), + (25, -130, 'a74ea9c9-8e18-4d2a-8cf6-73c6206c5da6', 'Nvarchar'), + (26, -131, 'a74ea9c9-8e18-4d2a-8cf6-73c6206c5da6', 'Nvarchar'), + (27, -132, 'a74ea9c9-8e18-4d2a-8cf6-73c6206c5da6', 'Nvarchar'), + (28, -133, '6c738306-4c17-4d88-b9bd-6546f3771597', 'Ntext'), + (29, -134, '928639ed-9c73-4028-920c-1e55dbb68783', 'Nvarchar'), + (30, -50, 'aaf99bb2-dbbe-444d-a296-185076bf0484', 'Date'), + (31, 1034, '158aa029-24ed-4948-939e-c3da209e5fba', 'Integer'), + (32, 1035, 'ead69342-f06d-4253-83ac-28000225583b', 'Integer'), + (33, 1036, '39f533e4-0551-4505-a64b-e0425c5ce775', 'Integer'), + (35, 1038, '60b7dabf-99cd-41eb-b8e9-4d2e669bbde9', 'Ntext'), + (36, 1039, 'cdbf0b5d-5cb2-445f-bc12-fcaaec07cf2c', 'Ntext'), + (37, 1040, '71b8ad1a-8dc2-425c-b6b8-faa158075e63', 'Ntext'), + (38, 1041, '4023e540-92f5-11dd-ad8b-0800200c9a66', 'Ntext'), + (39, 1042, '474FCFF8-9D2D-11DE-ABC6-AD7A56D89593', 'Ntext'), + (40, 1043, '7A2D436C-34C2-410F-898F-4A23B3D79F54', 'Ntext') +; +ALTER TABLE umbracoAppTree ADD FOREIGN KEY (appAlias) REFERENCES umbracoApp (appAlias) +; +ALTER TABLE cmsPropertyData ADD FOREIGN KEY (contentNodeId) REFERENCES umbracoNode (id) +; + +/* TABLE IS NEVER USED, REMOVED FOR 4.1 + +ALTER TABLE umbracoUser2userGroup ADD FOREIGN KEY (user) REFERENCES umbracoUser (id) +; +ALTER TABLE umbracoUser2userGroup ADD FOREIGN KEY (userGroup) REFERENCES umbracoUserGroup (id) +; + +*/ + +ALTER TABLE cmsDocument ADD FOREIGN KEY (nodeId) REFERENCES umbracoNode (id) +; +ALTER TABLE cmsMacroProperty ADD FOREIGN KEY (macroPropertyType) REFERENCES cmsMacroPropertyType (id) +; +ALTER TABLE umbracoUser ADD FOREIGN KEY (userType) REFERENCES umbracoUserType (id) +; +ALTER TABLE cmsTemplate ADD FOREIGN KEY (nodeId) REFERENCES umbracoNode (id) +; +ALTER TABLE cmsContentType ADD FOREIGN KEY (nodeId) REFERENCES umbracoNode (id) +; +ALTER TABLE umbracoNode ADD FOREIGN KEY (parentID) REFERENCES umbracoNode (id) +; +ALTER TABLE cmsPropertyType ADD FOREIGN KEY (tabId) REFERENCES cmsTab (id) +; +ALTER TABLE cmsContent ADD FOREIGN KEY (nodeId) REFERENCES umbracoNode (id) +; +ALTER TABLE umbracoUser2app ADD FOREIGN KEY (app) REFERENCES umbracoApp (appAlias) +; + +/* TABLE IS NEVER USED, REMOVED FOR 4.1 + +ALTER TABLE umbracoUser2userGroup ADD FOREIGN KEY (user) REFERENCES umbracoUser (id) +; + +*/ + +CREATE TABLE cmsTask +( +closed bit NOT NULL DEFAULT 0, +id int NOT NULL PRIMARY KEY AUTO_INCREMENT, +taskTypeId tinyint NOT NULL, +nodeId int NOT NULL, +parentUserId int NOT NULL, +userId int NOT NULL, +DateTime TIMESTAMP DEFAULT CURRENT_TIMESTAMP, +Comment nvarchar (500) NULL +) +; +CREATE TABLE cmsTaskType +( +id tinyint NOT NULL PRIMARY KEY AUTO_INCREMENT, +alias nvarchar (255) NOT NULL +) +; +insert into cmsTaskType (alias) values ('toTranslate') +; +insert into umbracoRelationType (`dual`, parentObjectType, childObjectType, name, alias) values (1, 'c66ba18e-eaf3-4cff-8a22-41b16d66a972', 'c66ba18e-eaf3-4cff-8a22-41b16d66a972', 'Relate Document On Copy','relateDocumentOnCopy') +; +ALTER TABLE cmsMacro ADD macroPython nvarchar(255) +; +INSERT INTO umbracoAppTree(treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) VALUES(0, 1, 4, 'developer', 'python', 'Python Files', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadPython') +; +INSERT INTO umbracoAppTree(treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) VALUES(0, 1, 2, 'settings', 'scripts', 'Scripts', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadScripts') +; +alter TABLE cmsContentType add thumbnail nvarchar(255) NOT NULL DEFAULT 'folder.png' +; +alter TABLE cmsContentType add description nvarchar(1500) NULL +; +alter TABLE cmsContentType add masterContentType int NULL +; +insert into cmsDataTypePreValues (id, dataTypeNodeId, value, sortorder, alias) values +(3,-87,',code,undo,redo,cut,copy,mcepasteword,stylepicker,bold,italic,bullist,numlist,outdent,indent,mcelink,unlink,mceinsertanchor,mceimage,umbracomacro,mceinserttable,mcecharmap,|1|1,2,3,|0|500,400|1049,|true|', 0, ''), +(4,1041,'default', 0, 'group') +; + +UPDATE umbracoUserType SET userTypeDefaultPermissions = CONCAT(userTypeDefaultPermissions, 'F') WHERE INSTR(userTypeDefaultPermissions,'A') >= 1 +AND INSTR(userTypeDefaultPermissions,'F') < 1 +; + +UPDATE umbracoUserType SET userTypeDefaultPermissions = CONCAT(userTypeDefaultPermissions, 'H') WHERE userTypeAlias = 'writer' +AND INSTR(userTypeDefaultPermissions,'F') < 1 +; + +INSERT IGNORE INTO umbracoUser2NodePermission (userID, nodeId, permission) +SELECT userID, nodeId, 'F' FROM umbracoUser2NodePermission WHERE permission='A' +; + +INSERT IGNORE INTO umbracoUser2NodePermission (userID, nodeId, permission) +SELECT DISTINCT userID, nodeId, 'H' FROM umbracoUser2NodePermission WHERE userId IN +(SELECT umbracoUser.id FROM umbracoUserType INNER JOIN umbracoUser ON umbracoUserType.id = umbracoUser.userType WHERE (umbracoUserType.userTypeAlias = 'writer')) +; + +INSERT IGNORE INTO umbracoAppTree (treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) +VALUES (0, 0, 0, 'content', 'contentRecycleBin', 'RecycleBin', 'folder.gif', 'folder_o.gif', 'umbraco', 'cms.presentation.Trees.ContentRecycleBin') +; + +INSERT IGNORE INTO umbracoAppTree (treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) +VALUES (0, 1, 1, 'users', 'userTypes', 'User Types', 'folder.gif', 'folder_o.gif', 'umbraco', 'cms.presentation.Trees.UserTypes') +; + +INSERT IGNORE INTO umbracoAppTree (treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) +VALUES (0, 1, 2, 'users', 'userPermissions', 'User Permissions', 'folder.gif', 'folder_o.gif', 'umbraco', 'cms.presentation.Trees.UserPermissions') +; + +CREATE TABLE cmsTagRelationship +( + nodeId int NOT NULL, + tagId int NOT NULL +); + +ALTER TABLE cmsTagRelationship ADD CONSTRAINT PK_user2app PRIMARY KEY CLUSTERED (nodeId, tagId); + +CREATE TABLE cmsTags( + id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + tag VARCHAR(200) NULL, + parentId INT NULL, + `group` VARCHAR(100) NULL +); + +ALTER TABLE cmsTagRelationship ADD CONSTRAINT umbracoNode_cmsTagRelationship FOREIGN KEY(nodeId) +REFERENCES umbracoNode (id) +ON DELETE CASCADE; + +ALTER TABLE cmsTagRelationship ADD CONSTRAINT cmsTags_cmsTagRelationship FOREIGN KEY(tagId) +REFERENCES cmsTags (id) +ON DELETE CASCADE; + +/* TRANSLATION RELATED SQL */ +INSERT INTO umbracoApp (appAlias, sortOrder, appIcon, appName, appInitWithTreeAlias) +VALUES ('translation', 5, '.traytranslation', 'Translation', NULL) +; +INSERT INTO umbracoAppTree (treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) +VALUES (0, 1, 1, 'translation','openTasks', 'Tasks assigned to you', '.sprTreeFolder', '.sprTreeFolder_o', 'umbraco', 'loadOpenTasks') +; +INSERT INTO umbracoAppTree (treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) +VALUES (0, 1, 2, 'translation','yourTasks', 'Tasks created by you', '.sprTreeFolder', '.sprTreeFolder_o', 'umbraco', 'loadYourTasks') +; + +ALTER TABLE umbraconode MODIFY COLUMN id INTEGER NOT NULL AUTO_INCREMENT; /* fix for MySQL bug 36411 */ + +/* remove auto increment so we can insert identity */ +ALTER TABLE umbraconode MODIFY COLUMN id INTEGER NOT NULL; +/* INSERT NEW MEDIA RECYCLE BIN NODE */ +INSERT INTO umbracoNode (id, trashed, parentID, nodeUser, level, path, sortOrder, uniqueID, text, nodeObjectType, createDate) +VALUES (-21, 0, -1, 0, 0, '-1,-21', 0, 'BF7C7CBC-952F-4518-97A2-69E9C7B33842', 'Recycle Bin', 'CF3D8E34-1C1C-41e9-AE56-878B57B32113', '2009/08/28 00:28:28.920') +; +/* re-add auto increment */ +ALTER TABLE umbraconode MODIFY COLUMN id INTEGER NOT NULL AUTO_INCREMENT; +/* Add the mediaRecycleBin tree type */ +INSERT IGNORE INTO umbracoAppTree (treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) +VALUES (0, 0, 0, 'media', 'mediaRecycleBin', 'RecycleBin', 'folder.gif', 'folder_o.gif', 'umbraco', 'cms.presentation.Trees.MediaRecycleBin') +; + +CREATE TABLE cmsPreviewXml( + nodeId int NOT NULL, + versionId CHAR(36) NOT NULL, + timestamp datetime NOT NULL, + xml LONGTEXT NOT NULL) +; +ALTER TABLE cmsPreviewXml ADD CONSTRAINT PK_cmsContentPreviewXml PRIMARY KEY CLUSTERED (nodeId, versionId) +; + + +/* Create missing indexes and primary keys */ +CREATE INDEX IX_Icon ON cmsContentType(nodeId, icon) +; + +/* CHANGE:Allan Stegelmann Laustsen */ +/* Create Custom Index to speed up tree loading */ +CREATE INDEX IX_contentid_versiondate ON cmscontentversion(CONTENTID, VERSIONDATE) +; +/* CHANGE:End */ + diff --git a/src/Umbraco.Tests/Migrations/SqlScripts/SqlCeTotal-480.sql b/src/Umbraco.Tests/Migrations/SqlScripts/SqlCeTotal-480.sql new file mode 100644 index 0000000000..84a6d0927a --- /dev/null +++ b/src/Umbraco.Tests/Migrations/SqlScripts/SqlCeTotal-480.sql @@ -0,0 +1,645 @@ +CREATE TABLE [umbracoRelation] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[parentId] [int] NOT NULL, +[childId] [int] NOT NULL, +[relType] [int] NOT NULL, +[datetime] [datetime] NOT NULL CONSTRAINT [DF_umbracoRelation_datetime] DEFAULT (getdate()), +[comment] [nvarchar] (1000) NOT NULL +) + +; +ALTER TABLE [umbracoRelation] ADD CONSTRAINT [PK_umbracoRelation] PRIMARY KEY ([id]) +; +CREATE TABLE [cmsDocument] +( +[nodeId] [int] NOT NULL, +[published] [bit] NOT NULL, +[documentUser] [int] NOT NULL, +[versionId] [uniqueidentifier] NOT NULL, +[text] [nvarchar] (255) NOT NULL, +[releaseDate] [datetime] NULL, +[expireDate] [datetime] NULL, +[updateDate] [datetime] NOT NULL CONSTRAINT [DF_cmsDocument_updateDate] DEFAULT (getdate()), +[templateId] [int] NULL, +[alias] [nvarchar] (255) NULL , +[newest] [bit] NOT NULL CONSTRAINT [DF_cmsDocument_newest] DEFAULT (0) +) + +; +ALTER TABLE [cmsDocument] ADD CONSTRAINT [PK_cmsDocument] PRIMARY KEY ([versionId]) +; +CREATE TABLE [umbracoLog] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[userId] [int] NOT NULL, +[NodeId] [int] NOT NULL, +[Datestamp] [datetime] NOT NULL CONSTRAINT [DF_umbracoLog_Datestamp] DEFAULT (getdate()), +[logHeader] [nvarchar] (50) NOT NULL, +[logComment] [nvarchar] (1000) NULL +) + +; +ALTER TABLE [umbracoLog] ADD CONSTRAINT [PK_umbracoLog] PRIMARY KEY ([id]) +; + +CREATE TABLE [umbracoApp] +( +[sortOrder] [tinyint] NOT NULL CONSTRAINT [DF_app_sortOrder] DEFAULT (0), +[appAlias] [nvarchar] (50) NOT NULL, +[appIcon] [nvarchar] (255) NOT NULL, +[appName] [nvarchar] (255) NOT NULL, +[appInitWithTreeAlias] [nvarchar] (255) NULL +) + +; +ALTER TABLE [umbracoApp] ADD CONSTRAINT [PK_umbracoApp] PRIMARY KEY ([appAlias]) +; +CREATE TABLE [cmsPropertyData] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[contentNodeId] [int] NOT NULL, +[versionId] [uniqueidentifier] NULL, +[propertytypeid] [int] NOT NULL, +[dataInt] [int] NULL, +[dataDate] [datetime] NULL, +[dataNvarchar] [nvarchar] (500) NULL, +[dataNtext] [ntext] NULL +) + +; +ALTER TABLE [cmsPropertyData] ADD CONSTRAINT [PK_cmsPropertyData] PRIMARY KEY ([id]) +; +CREATE INDEX [IX_cmsPropertyData] ON [cmsPropertyData] ([id]) +; +CREATE TABLE [cmsContent] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[nodeId] [int] NOT NULL, +[contentType] [int] NOT NULL +) + +; +ALTER TABLE [cmsContent] ADD CONSTRAINT [PK_cmsContent] PRIMARY KEY ([pk]) +; +CREATE TABLE [cmsContentType] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[nodeId] [int] NOT NULL, +[alias] [nvarchar] (255) NULL, +[icon] [nvarchar] (255) NULL +) + +; +ALTER TABLE [cmsContentType] ADD CONSTRAINT [PK_cmsContentType] PRIMARY KEY ([pk]) +; +CREATE TABLE [cmsMacroPropertyType] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[macroPropertyTypeAlias] [nvarchar] (50) NULL, +[macroPropertyTypeRenderAssembly] [nvarchar] (255) NULL, +[macroPropertyTypeRenderType] [nvarchar] (255) NULL, +[macroPropertyTypeBaseType] [nvarchar] (255) NULL +) + +; +ALTER TABLE [cmsMacroPropertyType] ADD CONSTRAINT [PK_macroPropertyType] PRIMARY KEY ([id]) +; + + +CREATE TABLE [cmsTab] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[contenttypeNodeId] [int] NOT NULL, +[text] [nvarchar] (255) NOT NULL, +[sortorder] [int] NOT NULL +) + +; +ALTER TABLE [cmsTab] ADD CONSTRAINT [PK_cmsTab] PRIMARY KEY ([id]) +; +CREATE TABLE [cmsTemplate] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[nodeId] [int] NOT NULL, +[master] [int] NULL, +[alias] [nvarchar] (100) NULL, +[design] [ntext] NOT NULL +) + +; +ALTER TABLE [cmsTemplate] ADD CONSTRAINT [PK_templates] PRIMARY KEY ([pk]) +; +CREATE TABLE [umbracoUser2app] +( +[user] [int] NOT NULL, +[app] [nvarchar] (50) NOT NULL +) + +; +ALTER TABLE [umbracoUser2app] ADD CONSTRAINT [PK_user2app] PRIMARY KEY ([user], [app]) +; +CREATE TABLE [umbracoUserType] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[userTypeAlias] [nvarchar] (50) NULL, +[userTypeName] [nvarchar] (255) NOT NULL, +[userTypeDefaultPermissions] [nvarchar] (50) NULL +) + +; +ALTER TABLE [umbracoUserType] ADD CONSTRAINT [PK_userType] PRIMARY KEY ([id]) +; +CREATE TABLE [umbracoUser] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[userDisabled] [bit] NOT NULL CONSTRAINT [DF_umbracoUser_userDisabled] DEFAULT (0), +[userNoConsole] [bit] NOT NULL CONSTRAINT [DF_umbracoUser_userNoConsole] DEFAULT (0), +[userType] [int] NOT NULL, +[startStructureID] [int] NOT NULL, +[startMediaID] [int] NULL, +[userName] [nvarchar] (255) NOT NULL, +[userLogin] [nvarchar] (125) NOT NULL, +[userPassword] [nvarchar] (125) NOT NULL, +[userEmail] [nvarchar] (255) NOT NULL, +[userDefaultPermissions] [nvarchar] (50) NULL, +[userLanguage] [nvarchar] (10) NULL +) + +; +ALTER TABLE [umbracoUser] ADD CONSTRAINT [PK_user] PRIMARY KEY ([id]) +; +CREATE TABLE [cmsDocumentType] +( +[contentTypeNodeId] [int] NOT NULL, +[templateNodeId] [int] NOT NULL, +[IsDefault] [bit] NOT NULL CONSTRAINT [DF_cmsDocumentType_IsDefault] DEFAULT (0) +) + +; +ALTER TABLE [cmsDocumentType] ADD CONSTRAINT [PK_cmsDocumentType] PRIMARY KEY ([contentTypeNodeId], [templateNodeId]) +; +CREATE TABLE [cmsMemberType] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[NodeId] [int] NOT NULL, +[propertytypeId] [int] NOT NULL, +[memberCanEdit] [bit] NOT NULL CONSTRAINT [DF_cmsMemberType_memberCanEdit] DEFAULT (0), +[viewOnProfile] [bit] NOT NULL CONSTRAINT [DF_cmsMemberType_viewOnProfile] DEFAULT (0) +) + +; +ALTER TABLE [cmsMemberType] ADD CONSTRAINT [PK_cmsMemberType] PRIMARY KEY ([pk]) +; +CREATE TABLE [cmsMember] +( +[nodeId] [int] NOT NULL, +[Email] [nvarchar] (1000) NOT NULL CONSTRAINT [DF_cmsMember_Email] DEFAULT (''), +[LoginName] [nvarchar] (1000) NOT NULL CONSTRAINT [DF_cmsMember_LoginName] DEFAULT (''), +[Password] [nvarchar] (1000) NOT NULL CONSTRAINT [DF_cmsMember_Password] DEFAULT ('') +) + +; +CREATE TABLE [umbracoNode] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[trashed] [bit] NOT NULL CONSTRAINT [DF_umbracoNode_trashed] DEFAULT (0), +[parentID] [int] NOT NULL, +[nodeUser] [int] NULL, +[level] [int] NOT NULL, +[path] [nvarchar] (150) NOT NULL, +[sortOrder] [int] NOT NULL, +[uniqueID] [uniqueidentifier] NULL, +[text] [nvarchar] (255) NULL, +[nodeObjectType] [uniqueidentifier] NULL, +[createDate] [datetime] NOT NULL CONSTRAINT [DF_umbracoNode_createDate] DEFAULT (getdate()) +) + +; +ALTER TABLE [umbracoNode] ADD CONSTRAINT [PK_structure] PRIMARY KEY ([id]) +; +; +CREATE TABLE [cmsPropertyType] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[dataTypeId] [int] NOT NULL, +[contentTypeId] [int] NOT NULL, +[tabId] [int] NULL, +[Alias] [nvarchar] (255) NOT NULL, +[Name] [nvarchar] (255) NULL, +[helpText] [nvarchar] (1000) NULL, +[sortOrder] [int] NOT NULL CONSTRAINT [DF__cmsProper__sortO__1EA48E88] DEFAULT (0), +[mandatory] [bit] NOT NULL CONSTRAINT [DF__cmsProper__manda__2180FB33] DEFAULT (0), +[validationRegExp] [nvarchar] (255) NULL, +[Description] [nvarchar] (2000) NULL +) + +; +ALTER TABLE [cmsPropertyType] ADD CONSTRAINT [PK_cmsPropertyType] PRIMARY KEY ([id]) +; + +CREATE TABLE [cmsMacroProperty] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[macroPropertyHidden] [bit] NOT NULL CONSTRAINT [DF_macroProperty_macroPropertyHidden] DEFAULT (0), +[macroPropertyType] [int] NOT NULL, +[macro] [int] NOT NULL, +[macroPropertySortOrder] [tinyint] NOT NULL CONSTRAINT [DF_macroProperty_macroPropertySortOrder] DEFAULT (0), +[macroPropertyAlias] [nvarchar] (50) NOT NULL, +[macroPropertyName] [nvarchar] (255) NOT NULL +) + +; +ALTER TABLE [cmsMacroProperty] ADD CONSTRAINT [PK_macroProperty] PRIMARY KEY ([id]) +; +CREATE TABLE [cmsMacro] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[macroUseInEditor] [bit] NOT NULL CONSTRAINT [DF_macro_macroUseInEditor] DEFAULT (0), +[macroRefreshRate] [int] NOT NULL CONSTRAINT [DF_macro_macroRefreshRate] DEFAULT (0), +[macroAlias] [nvarchar] (255) NOT NULL, +[macroName] [nvarchar] (255) NULL, +[macroScriptType] [nvarchar] (255) NULL, +[macroScriptAssembly] [nvarchar] (255) NULL, +[macroXSLT] [nvarchar] (255) NULL, +[macroCacheByPage] [bit] NOT NULL CONSTRAINT [DF_cmsMacro_macroCacheByPage] DEFAULT (1), +[macroCachePersonalized] [bit] NOT NULL CONSTRAINT [DF_cmsMacro_macroCachePersonalized] DEFAULT (0), +[macroDontRender] [bit] NOT NULL CONSTRAINT [DF_cmsMacro_macroDontRender] DEFAULT (0) +) + +; +ALTER TABLE [cmsMacro] ADD CONSTRAINT [PK_macro] PRIMARY KEY ([id]) +; +CREATE TABLE [cmsContentVersion] +( +[id] [int] NOT NULL IDENTITY(1, 1) PRIMARY KEY, +[ContentId] [int] NOT NULL, +[VersionId] [uniqueidentifier] NOT NULL, +[VersionDate] [datetime] NOT NULL CONSTRAINT [DF_cmsContentVersion_VersionDate] DEFAULT (getdate()) +) + +; +CREATE TABLE [umbracoAppTree] +( +[treeSilent] [bit] NOT NULL CONSTRAINT [DF_umbracoAppTree_treeSilent] DEFAULT (0), +[treeInitialize] [bit] NOT NULL CONSTRAINT [DF_umbracoAppTree_treeInitialize] DEFAULT (1), +[treeSortOrder] [tinyint] NOT NULL, +[appAlias] [nvarchar] (50) NOT NULL, +[treeAlias] [nvarchar] (150) NOT NULL, +[treeTitle] [nvarchar] (255) NOT NULL, +[treeIconClosed] [nvarchar] (255) NOT NULL, +[treeIconOpen] [nvarchar] (255) NOT NULL, +[treeHandlerAssembly] [nvarchar] (255) NOT NULL, +[treeHandlerType] [nvarchar] (255) NOT NULL, +[action] [nvarchar] (255) NULL +) + +; +ALTER TABLE [umbracoAppTree] ADD CONSTRAINT [PK_umbracoAppTree] PRIMARY KEY ([appAlias], [treeAlias]) +; + +CREATE TABLE [cmsContentTypeAllowedContentType] +( +[Id] [int] NOT NULL, +[AllowedId] [int] NOT NULL +) + +; +ALTER TABLE [cmsContentTypeAllowedContentType] ADD CONSTRAINT [PK_cmsContentTypeAllowedContentType] PRIMARY KEY ([Id], [AllowedId]) +; +CREATE TABLE [cmsContentXml] +( +[nodeId] [int] NOT NULL, +[xml] [ntext] NOT NULL +) + +; +ALTER TABLE [cmsContentXml] ADD CONSTRAINT [PK_cmsContentXml] PRIMARY KEY ([nodeId]) +; +CREATE TABLE [cmsDataType] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[nodeId] [int] NOT NULL, +[controlId] [uniqueidentifier] NOT NULL, +[dbType] [nvarchar] (50) NOT NULL +) + +; +ALTER TABLE [cmsDataType] ADD CONSTRAINT [PK_cmsDataType] PRIMARY KEY ([pk]) +; +CREATE TABLE [cmsDataTypePreValues] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[datatypeNodeId] [int] NOT NULL, +[value] [nvarchar] (255) NULL, +[sortorder] [int] NOT NULL, +[alias] [nvarchar] (50) NULL +) + +; +ALTER TABLE [cmsDataTypePreValues] ADD CONSTRAINT [PK_cmsDataTypePreValues] PRIMARY KEY ([id]) +; +CREATE TABLE [cmsDictionary] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[id] [uniqueidentifier] NOT NULL, +[parent] [uniqueidentifier] NOT NULL, +[key] [nvarchar] (1000) NOT NULL +) + +; +ALTER TABLE [cmsDictionary] ADD CONSTRAINT [PK_cmsDictionary] PRIMARY KEY ([pk]) +; +CREATE TABLE [cmsLanguageText] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[languageId] [int] NOT NULL, +[UniqueId] [uniqueidentifier] NOT NULL, +[value] [nvarchar] (1000) NOT NULL +) + +; +ALTER TABLE [cmsLanguageText] ADD CONSTRAINT [PK_cmsLanguageText] PRIMARY KEY ([pk]) +; +CREATE TABLE [cmsMember2MemberGroup] +( +[Member] [int] NOT NULL, +[MemberGroup] [int] NOT NULL +) + +; +ALTER TABLE [cmsMember2MemberGroup] ADD CONSTRAINT [PK_cmsMember2MemberGroup] PRIMARY KEY ([Member], [MemberGroup]) +; +CREATE TABLE [cmsStylesheet] +( +[nodeId] [int] NOT NULL, +[filename] [nvarchar] (100) NOT NULL, +[content] [ntext] NULL +) + +; +CREATE TABLE [cmsStylesheetProperty] +( +[nodeId] [int] NOT NULL, +[stylesheetPropertyEditor] [bit] NULL, +[stylesheetPropertyAlias] [nvarchar] (50) NULL, +[stylesheetPropertyValue] [nvarchar] (400) NULL +) + +; +CREATE TABLE [umbracoDomains] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[domainDefaultLanguage] [int] NULL, +[domainRootStructureID] [int] NULL, +[domainName] [nvarchar] (255) NOT NULL +) + +; +ALTER TABLE [umbracoDomains] ADD CONSTRAINT [PK_domains] PRIMARY KEY ([id]) +; +CREATE TABLE [umbracoLanguage] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[languageISOCode] [nvarchar] (10) NULL, +[languageCultureName] [nvarchar] (100) NULL +) + +; +ALTER TABLE [umbracoLanguage] ADD CONSTRAINT [PK_language] PRIMARY KEY ([id]) +; +CREATE TABLE [umbracoRelationType] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[dual] [bit] NOT NULL, +[parentObjectType] [uniqueidentifier] NOT NULL, +[childObjectType] [uniqueidentifier] NOT NULL, +[name] [nvarchar] (255) NOT NULL, +[alias] [nvarchar] (100) NULL +) + +; +ALTER TABLE [umbracoRelationType] ADD CONSTRAINT [PK_umbracoRelationType] PRIMARY KEY ([id]) +; + + +CREATE TABLE [umbracoUser2NodeNotify] +( +[userId] [int] NOT NULL, +[nodeId] [int] NOT NULL, +[action] [nchar] (1) NOT NULL +) + +; +ALTER TABLE [umbracoUser2NodeNotify] ADD CONSTRAINT [PK_umbracoUser2NodeNotify] PRIMARY KEY ([userId], [nodeId], [action]) +; +CREATE TABLE [umbracoUser2NodePermission] +( +[userId] [int] NOT NULL, +[nodeId] [int] NOT NULL, +[permission] [nchar] (1) NOT NULL +) + +; +ALTER TABLE [umbracoUser2NodePermission] ADD CONSTRAINT [PK_umbracoUser2NodePermission] PRIMARY KEY ([userId], [nodeId], [permission]) +; +CREATE TABLE [umbracoUserLogins] +( +[contextID] [uniqueidentifier] NOT NULL, +[userID] [int] NOT NULL, +[timeout] [bigint] NOT NULL +) + +; +ALTER TABLE [umbracoAppTree] ADD +CONSTRAINT [FK_umbracoAppTree_umbracoApp] FOREIGN KEY ([appAlias]) REFERENCES [umbracoApp] ([appAlias]) +; +ALTER TABLE [cmsPropertyData] ADD +CONSTRAINT [FK_cmsPropertyData_umbracoNode] FOREIGN KEY ([contentNodeId]) REFERENCES [umbracoNode] ([id]) +; + + +ALTER TABLE [cmsDocument] ADD +CONSTRAINT [FK_cmsDocument_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id]) +; +ALTER TABLE [cmsMacroProperty] ADD +CONSTRAINT [FK_umbracoMacroProperty_umbracoMacroPropertyType] FOREIGN KEY ([macroPropertyType]) REFERENCES [cmsMacroPropertyType] ([id]) +; +ALTER TABLE [umbracoUser] ADD +CONSTRAINT [FK_user_userType] FOREIGN KEY ([userType]) REFERENCES [umbracoUserType] ([id]) +; +ALTER TABLE [umbracoNode] ADD +CONSTRAINT [FK_umbracoNode_umbracoNode] FOREIGN KEY ([parentID]) REFERENCES [umbracoNode] ([id]) +; +ALTER TABLE [cmsTemplate] ADD +CONSTRAINT [FK_cmsTemplate_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id]) +; +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]) +; +ALTER TABLE [umbracoUser2app] ADD +CONSTRAINT [FK_umbracoUser2app_umbracoApp] FOREIGN KEY ([app]) REFERENCES [umbracoApp] ([appAlias]), +CONSTRAINT [FK_umbracoUser2app_umbracoUser] FOREIGN KEY ([user]) REFERENCES [umbracoUser] ([id]) +; + +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] +; +ALTER TABLE [umbracoAppTree] DROP CONSTRAINT [FK_umbracoAppTree_umbracoApp] +; +ALTER TABLE [umbracoUser2app] DROP CONSTRAINT [FK_umbracoUser2app_umbracoApp] +; +ALTER TABLE [umbracoUser2app] DROP CONSTRAINT [FK_umbracoUser2app_umbracoUser] +; +ALTER TABLE [cmsPropertyData] DROP CONSTRAINT [FK_cmsPropertyData_umbracoNode] +; + +ALTER TABLE [umbracoUser] DROP CONSTRAINT [FK_user_userType] +; +ALTER TABLE [cmsContentType] DROP CONSTRAINT [FK_cmsContentType_umbracoNode] +; +ALTER TABLE [cmsDocument] DROP CONSTRAINT [FK_cmsDocument_umbracoNode] +; +ALTER TABLE [umbracoNode] DROP CONSTRAINT [FK_umbracoNode_umbracoNode] +; + +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]) +; +ALTER TABLE [umbracoAppTree] ADD CONSTRAINT [FK_umbracoAppTree_umbracoApp] FOREIGN KEY ([appAlias]) REFERENCES [umbracoApp] ([appAlias]) +; +ALTER TABLE [umbracoUser2app] ADD CONSTRAINT [FK_umbracoUser2app_umbracoApp] FOREIGN KEY ([app]) REFERENCES [umbracoApp] ([appAlias]) +; +ALTER TABLE [umbracoUser2app] ADD CONSTRAINT [FK_umbracoUser2app_umbracoUser] FOREIGN KEY ([user]) REFERENCES [umbracoUser] ([id]) +; +ALTER TABLE [cmsPropertyData] ADD CONSTRAINT [FK_cmsPropertyData_umbracoNode] FOREIGN KEY ([contentNodeId]) REFERENCES [umbracoNode] ([id]) +; +ALTER TABLE [umbracoUser] ADD CONSTRAINT [FK_user_userType] FOREIGN KEY ([userType]) REFERENCES [umbracoUserType] ([id]) +; +ALTER TABLE [cmsContentType] ADD CONSTRAINT [FK_cmsContentType_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id]) +; +ALTER TABLE [cmsDocument] ADD CONSTRAINT [FK_cmsDocument_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id]) +; +ALTER TABLE [umbracoNode] ADD CONSTRAINT [FK_umbracoNode_umbracoNode] FOREIGN KEY ([parentID]) REFERENCES [umbracoNode] ([id]) +; + +ALTER TABLE cmsDataTypePreValues ALTER COLUMN value NVARCHAR(2500) NULL +; +CREATE TABLE [cmsTask] +( +[closed] [bit] NOT NULL CONSTRAINT [DF__cmsTask__closed__04E4BC85] DEFAULT ((0)), +[id] [int] NOT NULL IDENTITY(1, 1), +[taskTypeId] [int] NOT NULL, +[nodeId] [int] NOT NULL, +[parentUserId] [int] NOT NULL, +[userId] [int] NOT NULL, +[DateTime] [datetime] NOT NULL CONSTRAINT [DF__cmsTask__DateTim__05D8E0BE] DEFAULT (getdate()), +[Comment] [nvarchar] (500) NULL +) +; +ALTER TABLE [cmsTask] ADD CONSTRAINT [PK_cmsTask] PRIMARY KEY ([id]) +; +CREATE TABLE [cmsTaskType] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[alias] [nvarchar] (255) NOT NULL +) +; +ALTER TABLE [cmsTaskType] ADD CONSTRAINT [PK_cmsTaskType] PRIMARY KEY ([id]) +; +ALTER TABLE [cmsTask] ADD +CONSTRAINT [FK_cmsTask_cmsTaskType] FOREIGN KEY ([taskTypeId]) REFERENCES [cmsTaskType] ([id]) +; +insert into cmsTaskType (alias) values ('toTranslate') +; + +update umbracoUserType set userTypeDefaultPermissions = userTypeDefaultPermissions + '5' where userTypeAlias in ('editor','admin') +; + +; +insert into umbracoRelationType (dual, parentObjectType, childObjectType, name, alias) values (1, 'c66ba18e-eaf3-4cff-8a22-41b16d66a972', 'c66ba18e-eaf3-4cff-8a22-41b16d66a972', 'Relate Document On Copy','relateDocumentOnCopy') +; +ALTER TABLE cmsMacro ADD macroPython nvarchar(255) +; + + +UPDATE umbracoUserType SET userTypeDefaultPermissions = userTypeDefaultPermissions + 'F' WHERE CHARINDEX('A',userTypeDefaultPermissions,0) >= 1 +AND CHARINDEX('F',userTypeDefaultPermissions,0) < 1 +; + +UPDATE umbracoUserType SET userTypeDefaultPermissions = userTypeDefaultPermissions + 'H' WHERE userTypeAlias = 'writer' +AND CHARINDEX('F',userTypeDefaultPermissions,0) < 1 +; + +INSERT INTO umbracoUser2NodePermission (userID, nodeId, permission) +SELECT userID, nodeId, 'F' FROM umbracoUser2NodePermission WHERE permission='A' +; + +INSERT INTO umbracoUser2NodePermission (userID, nodeId, permission) +SELECT DISTINCT userID, nodeId, 'H' FROM umbracoUser2NodePermission WHERE userId IN +(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) +; + +CREATE TABLE [cmsTags]( + [id] [int] IDENTITY(1,1) NOT NULL, + [tag] [nvarchar](200) NULL, + [parentId] [int] NULL, + [group] [nvarchar](100) NULL) +; +alter TABLE [umbracoUser] +add [defaultToLiveEditing] bit NOT NULL CONSTRAINT +[DF_umbracoUser_defaultToLiveEditing] DEFAULT (0) +; + +CREATE TABLE [cmsPreviewXml]( + [nodeId] [int] NOT NULL, + [versionId] [uniqueidentifier] NOT NULL, + [timestamp] [datetime] NOT NULL, + [xml] [ntext] NOT NULL) +; + + +ALTER TABLE [umbracoNode] ALTER COLUMN id IDENTITY(1042,1) +; +ALTER TABLE [cmsContentType] ALTER COLUMN pk IDENTITY(535,1) +; +ALTER TABLE [umbracoUser] ALTER COLUMN id IDENTITY(1,1) +; +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 [cmsPropertyType] ALTER COLUMN id IDENTITY(28,1) +; +ALTER TABLE [umbracoLanguage] ALTER COLUMN id IDENTITY(2,1) +; +ALTER TABLE [cmsDataType] ALTER COLUMN pk IDENTITY(39,1) +; +ALTER TABLE [cmsDataTypePreValues] ALTER COLUMN id IDENTITY(5,1) \ No newline at end of file diff --git a/src/Umbraco.Tests/Migrations/SqlScripts/SqlResources.Designer.cs b/src/Umbraco.Tests/Migrations/SqlScripts/SqlResources.Designer.cs new file mode 100644 index 0000000000..cb4f12e103 --- /dev/null +++ b/src/Umbraco.Tests/Migrations/SqlScripts/SqlResources.Designer.cs @@ -0,0 +1,138 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.18010 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Umbraco.Tests.Migrations.SqlScripts { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SqlResources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SqlResources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Umbraco.Tests.Migrations.SqlScripts.SqlResources", typeof(SqlResources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to /******************************************************************************************* + /// + /// + /// + /// + /// + /// + /// + /// Umbraco database installation script for MySQL + /// + ///IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT + /// + /// Database version: 4.8.0.4 + /// + /// 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, t [rest of string was truncated]";. + /// + internal static string MySqlTotal_480 { + get { + return ResourceManager.GetString("MySqlTotal_480", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /******************************************************************************************* + /// + /// + /// + /// + /// + /// + /// + /// Umbraco database installation script for SQL Server CE 4 + /// + ///IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT + /// + /// Database version: 4.8.0.1 + /// + /// 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]";. + /// + internal static string SqlCeTotal_480 { + get { + return ResourceManager.GetString("SqlCeTotal_480", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /******************************************************************************************* + /// + /// + /// + /// + /// + /// + /// + /// Umbraco database installation script for SQL Server + /// + ///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 versi [rest of string was truncated]";. + /// + internal static string SqlServerTotal_480 { + get { + return ResourceManager.GetString("SqlServerTotal_480", resourceCulture); + } + } + } +} diff --git a/src/Umbraco.Tests/Migrations/SqlScripts/SqlResources.resx b/src/Umbraco.Tests/Migrations/SqlScripts/SqlResources.resx new file mode 100644 index 0000000000..6a41e64087 --- /dev/null +++ b/src/Umbraco.Tests/Migrations/SqlScripts/SqlResources.resx @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + mysqltotal-480.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + + sqlcetotal-480.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + + sqlservertotal-480.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + \ No newline at end of file diff --git a/src/Umbraco.Tests/Migrations/SqlScripts/SqlServerTotal-480.sql b/src/Umbraco.Tests/Migrations/SqlScripts/SqlServerTotal-480.sql new file mode 100644 index 0000000000..ff82b7a3fc --- /dev/null +++ b/src/Umbraco.Tests/Migrations/SqlScripts/SqlServerTotal-480.sql @@ -0,0 +1,1681 @@ +/******************************************************************************************* + + + + + + + + Umbraco database installation script for SQL Server + +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 + + + + + + + +********************************************************************************************/ + +CREATE TABLE [umbracoRelation] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[parentId] [int] NOT NULL, +[childId] [int] NOT NULL, +[relType] [int] NOT NULL, +[datetime] [datetime] NOT NULL CONSTRAINT [DF_umbracoRelation_datetime] DEFAULT (getdate()), +[comment] [nvarchar] (1000) COLLATE Danish_Norwegian_CI_AS NOT NULL +) + +; +ALTER TABLE [umbracoRelation] ADD CONSTRAINT [PK_umbracoRelation] PRIMARY KEY CLUSTERED ([id]) +; +CREATE TABLE [cmsDocument] +( +[nodeId] [int] NOT NULL, +[published] [bit] NOT NULL, +[documentUser] [int] NOT NULL, +[versionId] [uniqueidentifier] NOT NULL, +[text] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[releaseDate] [datetime] NULL, +[expireDate] [datetime] NULL, +[updateDate] [datetime] NOT NULL CONSTRAINT [DF_cmsDocument_updateDate] DEFAULT (getdate()), +[templateId] [int] NULL, +[alias] [nvarchar] (255) COLLATE Danish_Norwegian_CI_AS NULL , +[newest] [bit] NOT NULL CONSTRAINT [DF_cmsDocument_newest] DEFAULT (0) +) + +; +ALTER TABLE [cmsDocument] ADD CONSTRAINT [PK_cmsDocument] PRIMARY KEY CLUSTERED ([versionId]) +; +CREATE TABLE [umbracoLog] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[userId] [int] NOT NULL, +[NodeId] [int] NOT NULL, +[Datestamp] [datetime] NOT NULL CONSTRAINT [DF_umbracoLog_Datestamp] DEFAULT (getdate()), +[logHeader] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[logComment] [nvarchar] (1000) COLLATE Danish_Norwegian_CI_AS NULL +) + +; +ALTER TABLE [umbracoLog] ADD CONSTRAINT [PK_umbracoLog] PRIMARY KEY CLUSTERED ([id]) +; + +/* TABLES ARE NEVER USED, REMOVED FOR 4.1 + +CREATE TABLE [umbracoUserGroup] +( +[id] [smallint] NOT NULL IDENTITY(1, 1), +[userGroupName] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL +) +; +ALTER TABLE [umbracoUserGroup] ADD CONSTRAINT [PK_userGroup] PRIMARY KEY CLUSTERED ([id]) +; +CREATE TABLE [umbracoUser2userGroup] +( +[user] [int] NOT NULL, +[userGroup] [smallint] NOT NULL +) +; +ALTER TABLE [umbracoUser2userGroup] ADD CONSTRAINT [PK_user2userGroup] PRIMARY KEY CLUSTERED ([user], [userGroup]) +; + +*/ + +CREATE TABLE [umbracoApp] +( +[sortOrder] [tinyint] NOT NULL CONSTRAINT [DF_app_sortOrder] DEFAULT (0), +[appAlias] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[appIcon] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[appName] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[appInitWithTreeAlias] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL +) + +; +ALTER TABLE [umbracoApp] ADD CONSTRAINT [PK_umbracoApp] PRIMARY KEY CLUSTERED ([appAlias]) +; +CREATE TABLE [cmsPropertyData] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[contentNodeId] [int] NOT NULL, +[versionId] [uniqueidentifier] NULL, +[propertytypeid] [int] NOT NULL, +[dataInt] [int] NULL, +[dataDate] [datetime] NULL, +[dataNvarchar] [nvarchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[dataNtext] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL +) + +; +ALTER TABLE [cmsPropertyData] ADD CONSTRAINT [PK_cmsPropertyData] PRIMARY KEY CLUSTERED ([id]) +; +CREATE NONCLUSTERED INDEX [IX_cmsPropertyData] ON [cmsPropertyData] ([id]) +; +CREATE NONCLUSTERED INDEX [IX_cmsPropertyData_1] ON [cmsPropertyData] ([contentNodeId]) +; +CREATE NONCLUSTERED INDEX [IX_cmsPropertyData_2] ON [cmsPropertyData] ([versionId]) +; +CREATE NONCLUSTERED INDEX [IX_cmsPropertyData_3] ON [cmsPropertyData] ([propertytypeid]) +; +CREATE TABLE [cmsContent] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[nodeId] [int] NOT NULL, +[contentType] [int] NOT NULL +) + +; +ALTER TABLE [cmsContent] ADD CONSTRAINT [PK_cmsContent] PRIMARY KEY CLUSTERED ([pk]) +; +CREATE TABLE [cmsContentType] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[nodeId] [int] NOT NULL, +[alias] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[icon] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL +) + +; +ALTER TABLE [cmsContentType] ADD CONSTRAINT [PK_cmsContentType] PRIMARY KEY CLUSTERED ([pk]) +; +CREATE TABLE [cmsMacroPropertyType] +( +[id] [smallint] NOT NULL IDENTITY(1, 1), +[macroPropertyTypeAlias] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[macroPropertyTypeRenderAssembly] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[macroPropertyTypeRenderType] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[macroPropertyTypeBaseType] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL +) + +; +ALTER TABLE [cmsMacroPropertyType] ADD CONSTRAINT [PK_macroPropertyType] PRIMARY KEY CLUSTERED ([id]) +; + +/* TABLE IS NEVER USED, REMOVED FOR 4.1 + +CREATE TABLE [umbracoStylesheetProperty] +( +[id] [smallint] NOT NULL IDENTITY(1, 1), +[stylesheetPropertyEditor] [bit] NOT NULL CONSTRAINT [DF_stylesheetProperty_stylesheetPropertyEditor] DEFAULT (0), +[stylesheet] [tinyint] NOT NULL, +[stylesheetPropertyAlias] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[stylesheetPropertyName] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[stylesheetPropertyValue] [nvarchar] (400) COLLATE SQL_Latin1_General_CP1_CI_AS NULL +) +; + +ALTER TABLE [umbracoStylesheetProperty] ADD CONSTRAINT [PK_stylesheetProperty] PRIMARY KEY CLUSTERED ([id]) +; + +*/ + +CREATE TABLE [cmsTab] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[contenttypeNodeId] [int] NOT NULL, +[text] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[sortorder] [int] NOT NULL +) + +; +ALTER TABLE [cmsTab] ADD CONSTRAINT [PK_cmsTab] PRIMARY KEY CLUSTERED ([id]) +; +CREATE TABLE [cmsTemplate] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[nodeId] [int] NOT NULL, +[master] [int] NULL, +[alias] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[design] [ntext] COLLATE Danish_Norwegian_CI_AS NOT NULL +) + +; +ALTER TABLE [cmsTemplate] ADD CONSTRAINT [PK_templates] PRIMARY KEY CLUSTERED ([pk]) +; +CREATE TABLE [umbracoUser2app] +( +[user] [int] NOT NULL, +[app] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL +) + +; +ALTER TABLE [umbracoUser2app] ADD CONSTRAINT [PK_user2app] PRIMARY KEY CLUSTERED ([user], [app]) +; +CREATE TABLE [umbracoUserType] +( +[id] [smallint] NOT NULL IDENTITY(1, 1), +[userTypeAlias] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[userTypeName] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[userTypeDefaultPermissions] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL +) + +; +ALTER TABLE [umbracoUserType] ADD CONSTRAINT [PK_userType] PRIMARY KEY CLUSTERED ([id]) +; +CREATE TABLE [umbracoUser] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[userDisabled] [bit] NOT NULL CONSTRAINT [DF_umbracoUser_userDisabled] DEFAULT (0), +[userNoConsole] [bit] NOT NULL CONSTRAINT [DF_umbracoUser_userNoConsole] DEFAULT (0), +[userType] [smallint] NOT NULL, +[startStructureID] [int] NOT NULL, +[startMediaID] [int] NULL, +[userName] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[userLogin] [nvarchar] (125) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[userPassword] [nvarchar] (125) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[userEmail] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[userDefaultPermissions] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[userLanguage] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL +) + +; +ALTER TABLE [umbracoUser] ADD CONSTRAINT [PK_user] PRIMARY KEY CLUSTERED ([id]) +; +CREATE TABLE [cmsDocumentType] +( +[contentTypeNodeId] [int] NOT NULL, +[templateNodeId] [int] NOT NULL, +[IsDefault] [bit] NOT NULL CONSTRAINT [DF_cmsDocumentType_IsDefault] DEFAULT (0) +) + +; +ALTER TABLE [cmsDocumentType] ADD CONSTRAINT [PK_cmsDocumentType] PRIMARY KEY CLUSTERED ([contentTypeNodeId], [templateNodeId]) +; +CREATE TABLE [cmsMemberType] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[NodeId] [int] NOT NULL, +[propertytypeId] [int] NOT NULL, +[memberCanEdit] [bit] NOT NULL CONSTRAINT [DF_cmsMemberType_memberCanEdit] DEFAULT (0), +[viewOnProfile] [bit] NOT NULL CONSTRAINT [DF_cmsMemberType_viewOnProfile] DEFAULT (0) +) + +; +ALTER TABLE [cmsMemberType] ADD CONSTRAINT [PK_cmsMemberType] PRIMARY KEY CLUSTERED ([pk]) +; +CREATE TABLE [cmsMember] +( +[nodeId] [int] NOT NULL, +[Email] [nvarchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_cmsMember_Email] DEFAULT (''), +[LoginName] [nvarchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_cmsMember_LoginName] DEFAULT (''), +[Password] [nvarchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_cmsMember_Password] DEFAULT ('') +) + +; +CREATE TABLE [umbracoNode] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[trashed] [bit] NOT NULL CONSTRAINT [DF_umbracoNode_trashed] DEFAULT (0), +[parentID] [int] NOT NULL, +[nodeUser] [int] NULL, +[level] [smallint] NOT NULL, +[path] [nvarchar] (150) COLLATE Danish_Norwegian_CI_AS NOT NULL, +[sortOrder] [int] NOT NULL, +[uniqueID] [uniqueidentifier] NULL, +[text] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[nodeObjectType] [uniqueidentifier] NULL, +[createDate] [datetime] NOT NULL CONSTRAINT [DF_umbracoNode_createDate] DEFAULT (getdate()) +) + +; +ALTER TABLE [umbracoNode] ADD CONSTRAINT [PK_structure] PRIMARY KEY CLUSTERED ([id]) +; +CREATE NONCLUSTERED INDEX [IX_umbracoNodeParentId] ON [umbracoNode] ([parentID]) +; +CREATE NONCLUSTERED INDEX [IX_umbracoNodeObjectType] ON [umbracoNode] ([nodeObjectType]) +; +CREATE TABLE [cmsPropertyType] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[dataTypeId] [int] NOT NULL, +[contentTypeId] [int] NOT NULL, +[tabId] [int] NULL, +[Alias] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[Name] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[helpText] [nvarchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[sortOrder] [int] NOT NULL CONSTRAINT [DF__cmsProper__sortO__1EA48E88] DEFAULT (0), +[mandatory] [bit] NOT NULL CONSTRAINT [DF__cmsProper__manda__2180FB33] DEFAULT (0), +[validationRegExp] [nvarchar] (255) COLLATE Danish_Norwegian_CI_AS NULL, +[Description] [nvarchar] (2000) COLLATE Danish_Norwegian_CI_AS NULL +) + +; +ALTER TABLE [cmsPropertyType] ADD CONSTRAINT [PK_cmsPropertyType] PRIMARY KEY CLUSTERED ([id]) +; + +CREATE TABLE [cmsMacroProperty] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[macroPropertyHidden] [bit] NOT NULL CONSTRAINT [DF_macroProperty_macroPropertyHidden] DEFAULT (0), +[macroPropertyType] [smallint] NOT NULL, +[macro] [int] NOT NULL, +[macroPropertySortOrder] [tinyint] NOT NULL CONSTRAINT [DF_macroProperty_macroPropertySortOrder] DEFAULT (0), +[macroPropertyAlias] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[macroPropertyName] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL +) + +; +ALTER TABLE [cmsMacroProperty] ADD CONSTRAINT [PK_macroProperty] PRIMARY KEY CLUSTERED ([id]) +; +CREATE TABLE [cmsMacro] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[macroUseInEditor] [bit] NOT NULL CONSTRAINT [DF_macro_macroUseInEditor] DEFAULT (0), +[macroRefreshRate] [int] NOT NULL CONSTRAINT [DF_macro_macroRefreshRate] DEFAULT (0), +[macroAlias] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[macroName] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[macroScriptType] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[macroScriptAssembly] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[macroXSLT] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[macroCacheByPage] [bit] NOT NULL CONSTRAINT [DF_cmsMacro_macroCacheByPage] DEFAULT (1), +[macroCachePersonalized] [bit] NOT NULL CONSTRAINT [DF_cmsMacro_macroCachePersonalized] DEFAULT (0), +[macroDontRender] [bit] NOT NULL CONSTRAINT [DF_cmsMacro_macroDontRender] DEFAULT (0) +) + +; +ALTER TABLE [cmsMacro] ADD CONSTRAINT [PK_macro] PRIMARY KEY CLUSTERED ([id]) +; +CREATE TABLE [cmsContentVersion] +( +[id] [int] NOT NULL IDENTITY(1, 1) PRIMARY KEY, +[ContentId] [int] NOT NULL, +[VersionId] [uniqueidentifier] NOT NULL, +[VersionDate] [datetime] NOT NULL CONSTRAINT [DF_cmsContentVersion_VersionDate] DEFAULT (getdate()) +) + +; +CREATE TABLE [umbracoAppTree] +( +[treeSilent] [bit] NOT NULL CONSTRAINT [DF_umbracoAppTree_treeSilent] DEFAULT (0), +[treeInitialize] [bit] NOT NULL CONSTRAINT [DF_umbracoAppTree_treeInitialize] DEFAULT (1), +[treeSortOrder] [tinyint] NOT NULL, +[appAlias] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[treeAlias] [nvarchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[treeTitle] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[treeIconClosed] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[treeIconOpen] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[treeHandlerAssembly] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[treeHandlerType] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[action] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL +) + +; +ALTER TABLE [umbracoAppTree] ADD CONSTRAINT [PK_umbracoAppTree] PRIMARY KEY CLUSTERED ([appAlias], [treeAlias]) +; + +CREATE TABLE [cmsContentTypeAllowedContentType] +( +[Id] [int] NOT NULL, +[AllowedId] [int] NOT NULL +) + +; +ALTER TABLE [cmsContentTypeAllowedContentType] ADD CONSTRAINT [PK_cmsContentTypeAllowedContentType] PRIMARY KEY CLUSTERED ([Id], [AllowedId]) +; +CREATE TABLE [cmsContentXml] +( +[nodeId] [int] NOT NULL, +[xml] [ntext] COLLATE Danish_Norwegian_CI_AS NOT NULL +) + +; +ALTER TABLE [cmsContentXml] ADD CONSTRAINT [PK_cmsContentXml] PRIMARY KEY CLUSTERED ([nodeId]) +; +CREATE TABLE [cmsDataType] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[nodeId] [int] NOT NULL, +[controlId] [uniqueidentifier] NOT NULL, +[dbType] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL +) + +; +ALTER TABLE [cmsDataType] ADD CONSTRAINT [PK_cmsDataType] PRIMARY KEY CLUSTERED ([pk]) +; +CREATE TABLE [cmsDataTypePreValues] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[datatypeNodeId] [int] NOT NULL, +[value] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[sortorder] [int] NOT NULL, +[alias] [nvarchar] (50) COLLATE Danish_Norwegian_CI_AS NULL +) + +; +ALTER TABLE [cmsDataTypePreValues] ADD CONSTRAINT [PK_cmsDataTypePreValues] PRIMARY KEY CLUSTERED ([id]) +; +CREATE TABLE [cmsDictionary] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[id] [uniqueidentifier] NOT NULL, +[parent] [uniqueidentifier] NOT NULL, +[key] [nvarchar] (1000) COLLATE Danish_Norwegian_CI_AS NOT NULL +) + +; +ALTER TABLE [cmsDictionary] ADD CONSTRAINT [PK_cmsDictionary] PRIMARY KEY CLUSTERED ([pk]) +; +CREATE TABLE [cmsLanguageText] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[languageId] [int] NOT NULL, +[UniqueId] [uniqueidentifier] NOT NULL, +[value] [nvarchar] (1000) COLLATE Danish_Norwegian_CI_AS NOT NULL +) + +; +ALTER TABLE [cmsLanguageText] ADD CONSTRAINT [PK_cmsLanguageText] PRIMARY KEY CLUSTERED ([pk]) +; +CREATE TABLE [cmsMember2MemberGroup] +( +[Member] [int] NOT NULL, +[MemberGroup] [int] NOT NULL +) + +; +ALTER TABLE [cmsMember2MemberGroup] ADD CONSTRAINT [PK_cmsMember2MemberGroup] PRIMARY KEY CLUSTERED ([Member], [MemberGroup]) +; +CREATE TABLE [cmsStylesheet] +( +[nodeId] [int] NOT NULL, +[filename] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[content] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL +) + +; +CREATE TABLE [cmsStylesheetProperty] +( +[nodeId] [int] NOT NULL, +[stylesheetPropertyEditor] [bit] NULL, +[stylesheetPropertyAlias] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[stylesheetPropertyValue] [nvarchar] (400) COLLATE SQL_Latin1_General_CP1_CI_AS NULL +) + +; +CREATE TABLE [umbracoDomains] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[domainDefaultLanguage] [int] NULL, +[domainRootStructureID] [int] NULL, +[domainName] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL +) + +; +ALTER TABLE [umbracoDomains] ADD CONSTRAINT [PK_domains] PRIMARY KEY CLUSTERED ([id]) +; +CREATE TABLE [umbracoLanguage] +( +[id] [smallint] NOT NULL IDENTITY(1, 1), +[languageISOCode] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, +[languageCultureName] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL +) + +; +ALTER TABLE [umbracoLanguage] ADD CONSTRAINT [PK_language] PRIMARY KEY CLUSTERED ([id]) +; +CREATE TABLE [umbracoRelationType] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[dual] [bit] NOT NULL, +[parentObjectType] [uniqueidentifier] NOT NULL, +[childObjectType] [uniqueidentifier] NOT NULL, +[name] [nvarchar] (255) COLLATE Danish_Norwegian_CI_AS NOT NULL, +[alias] [nvarchar] (100) COLLATE Danish_Norwegian_CI_AS NULL +) + +; +ALTER TABLE [umbracoRelationType] ADD CONSTRAINT [PK_umbracoRelationType] PRIMARY KEY CLUSTERED ([id]) +; + +/* TABLE IS NEVER USED, REMOVED FOR 4.1 + +CREATE TABLE [umbracoStylesheet] +( +[nodeId] [int] NOT NULL, +[filename] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, +[content] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL +) +; + +ALTER TABLE [umbracoStylesheet] ADD CONSTRAINT [PK_umbracoStylesheet] PRIMARY KEY CLUSTERED ([nodeId]) +; + +*/ + +CREATE TABLE [umbracoUser2NodeNotify] +( +[userId] [int] NOT NULL, +[nodeId] [int] NOT NULL, +[action] [char] (1) COLLATE Danish_Norwegian_CI_AS NOT NULL +) + +; +ALTER TABLE [umbracoUser2NodeNotify] ADD CONSTRAINT [PK_umbracoUser2NodeNotify] PRIMARY KEY CLUSTERED ([userId], [nodeId], [action]) +; +CREATE TABLE [umbracoUser2NodePermission] +( +[userId] [int] NOT NULL, +[nodeId] [int] NOT NULL, +[permission] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL +) + +; +ALTER TABLE [umbracoUser2NodePermission] ADD CONSTRAINT [PK_umbracoUser2NodePermission] PRIMARY KEY CLUSTERED ([userId], [nodeId], [permission]) +; +CREATE TABLE [umbracoUserLogins] +( +[contextID] [uniqueidentifier] NOT NULL, +[userID] [int] NOT NULL, +[timeout] [bigint] NOT NULL +) +; +CREATE CLUSTERED INDEX umbracoUserLogins_Index ON umbracoUserLogins (contextID) +; +ALTER TABLE [umbracoAppTree] ADD +CONSTRAINT [FK_umbracoAppTree_umbracoApp] FOREIGN KEY ([appAlias]) REFERENCES [umbracoApp] ([appAlias]) +; +ALTER TABLE [cmsPropertyData] ADD +CONSTRAINT [FK_cmsPropertyData_umbracoNode] FOREIGN KEY ([contentNodeId]) REFERENCES [umbracoNode] ([id]) +; + +/* TABLES ARE NEVER USED, REMOVED FOR 4.1 + +ALTER TABLE [umbracoUser2userGroup] ADD +CONSTRAINT [FK_user2userGroup_user] FOREIGN KEY ([user]) REFERENCES [umbracoUser] ([id]), +CONSTRAINT [FK_user2userGroup_userGroup] FOREIGN KEY ([userGroup]) REFERENCES [umbracoUserGroup] ([id]) +; + +*/ + +ALTER TABLE [cmsDocument] ADD +CONSTRAINT [FK_cmsDocument_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id]) +; +ALTER TABLE [cmsMacroProperty] ADD +CONSTRAINT [FK_umbracoMacroProperty_umbracoMacroPropertyType] FOREIGN KEY ([macroPropertyType]) REFERENCES [cmsMacroPropertyType] ([id]) +; +ALTER TABLE [umbracoUser] ADD +CONSTRAINT [FK_user_userType] FOREIGN KEY ([userType]) REFERENCES [umbracoUserType] ([id]) +; +ALTER TABLE [umbracoNode] ADD +CONSTRAINT [FK_umbracoNode_umbracoNode] FOREIGN KEY ([parentID]) REFERENCES [umbracoNode] ([id]) +; +ALTER TABLE [cmsTemplate] ADD +CONSTRAINT [FK_cmsTemplate_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id]) +; +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]) +; +ALTER TABLE [umbracoUser2app] ADD +CONSTRAINT [FK_umbracoUser2app_umbracoApp] FOREIGN KEY ([app]) REFERENCES [umbracoApp] ([appAlias]), +CONSTRAINT [FK_umbracoUser2app_umbracoUser] FOREIGN KEY ([user]) REFERENCES [umbracoUser] ([id]) +; + +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] +; +ALTER TABLE [umbracoAppTree] DROP CONSTRAINT [FK_umbracoAppTree_umbracoApp] +; +ALTER TABLE [umbracoUser2app] DROP CONSTRAINT [FK_umbracoUser2app_umbracoApp] +; +ALTER TABLE [umbracoUser2app] DROP CONSTRAINT [FK_umbracoUser2app_umbracoUser] +; +ALTER TABLE [cmsPropertyData] DROP CONSTRAINT [FK_cmsPropertyData_umbracoNode] +; + +/* TABLE IS NEVER USED, REMOVED FOR 4.1 + +ALTER TABLE [umbracoUser2userGroup] DROP CONSTRAINT [FK_user2userGroup_user] +; +ALTER TABLE [umbracoUser2userGroup] DROP CONSTRAINT [FK_user2userGroup_userGroup] +; + +*/ + +ALTER TABLE [umbracoUser] DROP CONSTRAINT [FK_user_userType] +; +ALTER TABLE [cmsContentType] DROP CONSTRAINT [FK_cmsContentType_umbracoNode] +; +ALTER TABLE [cmsDocument] DROP CONSTRAINT [FK_cmsDocument_umbracoNode] +; +ALTER TABLE [umbracoNode] DROP CONSTRAINT [FK_umbracoNode_umbracoNode] +; +SET IDENTITY_INSERT [umbracoNode] ON +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-92, 0, -1, 0, 11, N'-1,-92', 37, 'f0bc4bfb-b499-40d6-ba86-058885a5178c', N'Label', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20040930 14:01:49.920') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-90, 0, -1, 0, 11, N'-1,-90', 35, '84c6b441-31df-4ffe-b67e-67d5bc3ae65a', N'Upload', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20040930 14:01:49.920') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-89, 0, -1, 0, 11, N'-1,-89', 34, 'c6bac0dd-4ab9-45b1-8e30-e4b619ee5da3', N'Textbox multiple', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20040930 14:01:49.920') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-88, 0, -1, 0, 11, N'-1,-88', 33, '0cc0eba1-9960-42c9-bf9b-60e150b429ae', N'Textstring', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20040930 14:01:49.920') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-87, 0, -1, 0, 11, N'-1,-87', 32, 'ca90c950-0aff-4e72-b976-a30b1ac57dad', N'Richtext editor', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20040930 14:01:49.920') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-51, 0, -1, 0, 11, N'-1,-51', 4, '2e6d3631-066e-44b8-aec4-96f09099b2b5', N'Numeric', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20040930 14:01:49.920') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-49, 0, -1, 0, 11, N'-1,-49', 2, '92897bc6-a5f3-4ffe-ae27-f2e7e33dda49', N'True/false', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20040930 14:01:49.920') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-43, 0, -1, 0, 1, N'-1,-43', 2, 'fbaf13a8-4036-41f2-93a3-974f678c312a', N'Checkbox list', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20041015 14:11:04.367') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-42, 0, -1, 0, 1, N'-1,-42', 2, '0b6a45e7-44ba-430d-9da5-4e46060b9e03', N'Dropdown', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20041015 14:10:59.000') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-41, 0, -1, 0, 1, N'-1,-41', 2, '5046194e-4237-453c-a547-15db3a07c4e1', N'Date Picker', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20041015 14:10:54.303') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-40, 0, -1, 0, 1, N'-1,-40', 2, 'bb5f57c9-ce2b-4bb9-b697-4caca783a805', N'Radiobox', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20041015 14:10:49.253') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-39, 0, -1, 0, 1, N'-1,-39', 2, 'f38f0ac7-1d27-439c-9f3f-089cd8825a53', N'Dropdown multiple', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20041015 14:10:44.480') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-38, 0, -1, 0, 1, N'-1,-38', 2, 'fd9f1447-6c61-4a7c-9595-5aa39147d318', N'Folder Browser', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20041015 14:10:37.020') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-37, 0, -1, 0, 1, N'-1,-37', 2, '0225af17-b302-49cb-9176-b9f35cab9c17', N'Approved Color', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20041015 14:10:30.580') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-36, 0, -1, 0, 1, N'-1,-36', 2, 'e4d66c0f-b935-4200-81f0-025f7256b89a', N'Date Picker with time', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20041015 14:10:23.007') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-1, 0, -1, 0, 0, N'-1', 0, '916724a5-173d-4619-b97e-b9de133dd6f5', N'SYSTEM DATA: umbraco master root', 'ea7d8624-4cfe-4578-a871-24aa946bf34d', '20040930 14:01:49.920') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1031, 0, -1, 1, 1, N'-1,1031', 2, 'f38bd2d7-65d0-48e6-95dc-87ce06ec2d3d', N'Folder', '4ea4382b-2f5a-4c2b-9587-ae9b3cf3602e', '20041201 00:13:40.743') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1032, 0, -1, 1, 1, N'-1,1032', 2, 'cc07b313-0843-4aa8-bbda-871c8da728c8', N'Image', '4ea4382b-2f5a-4c2b-9587-ae9b3cf3602e', '20041201 00:13:43.737') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1033, 0, -1, 1, 1, N'-1,1033', 2, '4c52d8ab-54e6-40cd-999c-7a5f24903e4d', N'File', '4ea4382b-2f5a-4c2b-9587-ae9b3cf3602e', '20041201 00:13:46.210') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1034, 0, -1, 0, 1, N'-1,1034', 2, 'a6857c73-d6e9-480c-b6e6-f15f6ad11125', N'Content Picker', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20060103 13:07:29.203') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1035, 0, -1, 0, 1, N'-1,1035', 2, '93929b9a-93a2-4e2a-b239-d99334440a59', N'Media Picker', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20060103 13:07:36.143') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1036, 0, -1, 0, 1, N'-1,1036', 2, '2b24165f-9782-4aa3-b459-1de4a4d21f60', N'Member Picker', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20060103 13:07:40.260') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1038, 0, -1, 0, 1, N'-1,1038', 2, '1251c96c-185c-4e9b-93f4-b48205573cbd', N'Simple Editor', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20060103 13:07:55.250') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1039, 0, -1, 0, 1, N'-1,1039', 2, '06f349a9-c949-4b6a-8660-59c10451af42', N'Ultimate Picker', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20060103 13:07:55.250') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1040, 0, -1, 0, 1, N'-1,1040', 2, '21e798da-e06e-4eda-a511-ed257f78d4fa', N'Related Links', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20060103 13:07:55.250') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1041, 0, -1, 0, 1, N'-1,1041', 2, 'b6b73142-b9c1-4bf8-a16d-e1c23320b549', N'Tags', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20060103 13:07:55.250') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1042, 0, -1, 0, 1, N'-1,1042', 2, '0a452bd5-83f9-4bc3-8403-1286e13fb77e', N'Macro Container', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20060103 13:07:55.250') +INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1043, 0, -1, 0, 1, N'-1,1043', 2, '1df9f033-e6d4-451f-b8d2-e0cbc50a836f', N'Image Cropper', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20060103 13:07:55.250') + +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]) VALUES (533, 1032, N'Image', N'mediaPhoto.gif') +INSERT INTO [cmsContentType] ([pk], [nodeId], [alias], [icon]) VALUES (534, 1033, N'File', N'mediaMulti.gif') +SET IDENTITY_INSERT [cmsContentType] OFF +; +SET IDENTITY_INSERT [umbracoUser] ON +INSERT INTO [umbracoUser] ([id], [userDisabled], [userNoConsole], [userType], [startStructureID], [startMediaID], [userName], [userLogin], [userPassword], [userEmail], [userDefaultPermissions], [userLanguage]) VALUES (0, 0, 0, 1, -1, -1, N'Administrator', N'admin', N'default', N'', NULL, N'en') +SET IDENTITY_INSERT [umbracoUser] OFF +; +SET IDENTITY_INSERT [umbracoUserType] ON +INSERT INTO [umbracoUserType] ([id], [userTypeAlias], [userTypeName], [userTypeDefaultPermissions]) VALUES (1, N'admin', N'Administrators', N'CADMOSKTPIURZ:') +INSERT INTO [umbracoUserType] ([id], [userTypeAlias], [userTypeName], [userTypeDefaultPermissions]) VALUES (2, N'writer', N'Writer', N'CAH:') +INSERT INTO [umbracoUserType] ([id], [userTypeAlias], [userTypeName], [userTypeDefaultPermissions]) VALUES (3, N'editor', N'Editors', N'CADMOSKTPUZ:') +SET IDENTITY_INSERT [umbracoUserType] OFF +; +INSERT INTO [umbracoUser2app] ([user], [app]) VALUES (0, N'content') +INSERT INTO [umbracoUser2app] ([user], [app]) VALUES (0, N'developer') +INSERT INTO [umbracoUser2app] ([user], [app]) VALUES (0, N'media') +INSERT INTO [umbracoUser2app] ([user], [app]) VALUES (0, N'member') +INSERT INTO [umbracoUser2app] ([user], [app]) VALUES (0, N'settings') +INSERT INTO [umbracoUser2app] ([user], [app]) VALUES (0, N'users') + +INSERT INTO [umbracoApp] ([appAlias], [sortOrder], [appIcon], [appName], [appInitWithTreeAlias]) VALUES (N'content', 0, N'.traycontent', N'Indhold', N'content') +INSERT INTO [umbracoApp] ([appAlias], [sortOrder], [appIcon], [appName], [appInitWithTreeAlias]) VALUES (N'developer', 7, N'.traydeveloper', N'Developer', NULL) +INSERT INTO [umbracoApp] ([appAlias], [sortOrder], [appIcon], [appName], [appInitWithTreeAlias]) VALUES (N'media', 1, N'.traymedia', N'Mediearkiv', NULL) +INSERT INTO [umbracoApp] ([appAlias], [sortOrder], [appIcon], [appName], [appInitWithTreeAlias]) VALUES (N'member', 8, N'.traymember', N'Medlemmer', NULL) +INSERT INTO [umbracoApp] ([appAlias], [sortOrder], [appIcon], [appName], [appInitWithTreeAlias]) VALUES (N'settings', 6, N'.traysettings', N'Indstillinger', NULL) +INSERT INTO [umbracoApp] ([appAlias], [sortOrder], [appIcon], [appName], [appInitWithTreeAlias]) VALUES (N'users', 5, N'.trayusers', N'Brugere', NULL) + + +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'content', N'content', 1, 1, 0, N'Indhold', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadContent') +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'developer', N'cacheBrowser', 0, 1, 0, N'CacheBrowser', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadCache') +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'developer', N'CacheItem', 0, 0, 0, N'Cachebrowser', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadCacheItem') +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'developer', N'datatype', 0, 1, 1, N'Datatyper', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadDataTypes') +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'developer', N'macros', 0, 1, 2, N'Macros', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadMacros') +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'developer', N'xslt', 0, 1, 5, N'XSLT Files', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadXslt') + +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'media', N'media', 0, 1, 0, N'Medier', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadMedia') +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'member', N'member', 0, 1, 0, N'Medlemmer', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadMembers') +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'member', N'memberGroup', 0, 1, 1, N'MemberGroups', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadMemberGroups') +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'member', N'memberType', 0, 1, 2, N'Medlemstyper', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadMemberTypes') +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType], [action]) VALUES (N'settings', N'dictionary', 0, 1, 3, N'Dictionary', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadDictionary', N'openDictionary()') +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'settings', N'languages', 0, 1, 4, N'Languages', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadLanguages') +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'settings', N'mediaTypes', 0, 1, 5, N'Medietyper', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadMediaTypes') +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'settings', N'nodeTypes', 0, 1, 6, N'Dokumenttyper', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadNodeTypes') +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'settings', N'stylesheetProperty', 0, 0, 0, N'Stylesheet Property', N'', N'', N'umbraco', N'loadStylesheetProperty') +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'settings', N'stylesheets', 0, 1, 0, N'Stylesheets', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadStylesheets') +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'settings', N'templates', 0, 1, 1, N'Templates', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadTemplates') + +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'users', N'users', 0, 1, 0, N'Brugere', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadUsers') + +SET IDENTITY_INSERT [cmsMacroPropertyType] ON +INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (3, N'mediaCurrent', N'umbraco.macroRenderings', N'media', N'Int32') +INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (4, N'contentSubs', N'umbraco.macroRenderings', N'content', N'Int32') +INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (5, N'contentRandom', N'umbraco.macroRenderings', N'content', N'Int32') +INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (6, N'contentPicker', N'umbraco.macroRenderings', N'content', N'Int32') +INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (13, N'number', N'umbraco.macroRenderings', N'numeric', N'Int32') +INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (14, N'bool', N'umbraco.macroRenderings', N'yesNo', N'Boolean') +INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (16, N'text', N'umbraco.macroRenderings', N'text', N'String') +INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (17, N'contentTree', N'umbraco.macroRenderings', N'content', N'Int32') +INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (18, N'contentType', N'umbraco.macroRenderings', N'contentTypeSingle', N'Int32') +INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (19, N'contentTypeMultiple', N'umbraco.macroRenderings', N'contentTypeMultiple', N'Int32') +INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (20, N'contentAll', N'umbraco.macroRenderings', N'content', N'Int32') +INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (21, N'tabPicker', N'umbraco.macroRenderings', N'tabPicker', N'String') +INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (22, N'tabPickerMultiple', N'umbraco.macroRenderings', N'tabPickerMultiple', N'String') +INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (23, N'propertyTypePicker', N'umbraco.macroRenderings', N'propertyTypePicker', N'String') +INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (24, N'propertyTypePickerMultiple', N'umbraco.macroRenderings', N'propertyTypePickerMultiple', N'String') +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 [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) +SET IDENTITY_INSERT [cmsPropertyType] OFF +; +SET IDENTITY_INSERT [umbracoLanguage] ON +INSERT INTO [umbracoLanguage] ([id], [languageISOCode], [languageCultureName]) VALUES (1, N'en-US', N'en-US') +SET IDENTITY_INSERT [umbracoLanguage] OFF +; +INSERT INTO [cmsContentTypeAllowedContentType] ([Id], [AllowedId]) VALUES (1031, 1031) +INSERT INTO [cmsContentTypeAllowedContentType] ([Id], [AllowedId]) VALUES (1031, 1032) +INSERT INTO [cmsContentTypeAllowedContentType] ([Id], [AllowedId]) VALUES (1031, 1033) +SET IDENTITY_INSERT [cmsDataType] ON +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (4, -49, '38b352c1-e9f8-4fd8-9324-9a2eab06d97a', 'Integer') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (6, -51, '1413afcb-d19a-4173-8e9a-68288d2a73b8', 'Integer') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (8, -87, '5E9B75AE-FACE-41c8-B47E-5F4B0FD82F83', 'Ntext') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (9, -88, 'ec15c1e5-9d90-422a-aa52-4f7622c63bea', 'Nvarchar') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (10, -89, '67db8357-ef57-493e-91ac-936d305e0f2a', 'Ntext') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (11, -90, '5032a6e6-69e3-491d-bb28-cd31cd11086c', 'Nvarchar') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (12, -91, 'a74ea9c9-8e18-4d2a-8cf6-73c6206c5da6', 'Nvarchar') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (13, -92, '6c738306-4c17-4d88-b9bd-6546f3771597', 'Nvarchar') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (14, -36, 'b6fb1622-afa5-4bbf-a3cc-d9672a442222', 'Date') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (15, -37, 'f8d60f68-ec59-4974-b43b-c46eb5677985', 'Nvarchar') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (16, -38, 'cccd4ae9-f399-4ed2-8038-2e88d19e810c', 'Nvarchar') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (17, -39, '928639ed-9c73-4028-920c-1e55dbb68783', 'Nvarchar') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (18, -40, 'a52c7c1c-c330-476e-8605-d63d3b84b6a6', 'Nvarchar') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (19, -41, '23e93522-3200-44e2-9f29-e61a6fcbb79a', 'Date') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (20, -42, 'a74ea9c9-8e18-4d2a-8cf6-73c6206c5da6', 'Integer') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (21, -43, 'b4471851-82b6-4c75-afa4-39fa9c6a75e9', 'Nvarchar') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (22, -44, 'a3776494-0574-4d93-b7de-efdfdec6f2d1', 'Ntext') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (23, -128, 'a52c7c1c-c330-476e-8605-d63d3b84b6a6', 'Nvarchar') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (24, -129, '928639ed-9c73-4028-920c-1e55dbb68783', 'Nvarchar') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (25, -130, 'a74ea9c9-8e18-4d2a-8cf6-73c6206c5da6', 'Nvarchar') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (26, -131, 'a74ea9c9-8e18-4d2a-8cf6-73c6206c5da6', 'Nvarchar') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (27, -132, 'a74ea9c9-8e18-4d2a-8cf6-73c6206c5da6', 'Nvarchar') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (28, -133, '6c738306-4c17-4d88-b9bd-6546f3771597', 'Ntext') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (29, -134, '928639ed-9c73-4028-920c-1e55dbb68783', 'Nvarchar') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (30, -50, 'aaf99bb2-dbbe-444d-a296-185076bf0484', 'Date') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (31, 1034, '158aa029-24ed-4948-939e-c3da209e5fba', 'Integer') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (32, 1035, 'ead69342-f06d-4253-83ac-28000225583b', 'Integer') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (33, 1036, '39f533e4-0551-4505-a64b-e0425c5ce775', 'Integer') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (35, 1038, '60b7dabf-99cd-41eb-b8e9-4d2e669bbde9', 'Ntext') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (36, 1039, 'cdbf0b5d-5cb2-445f-bc12-fcaaec07cf2c', 'Ntext') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (37, 1040, '71b8ad1a-8dc2-425c-b6b8-faa158075e63', 'Ntext') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (38, 1041, '4023e540-92f5-11dd-ad8b-0800200c9a66', 'Ntext') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (39, 1042, '474FCFF8-9D2D-11DE-ABC6-AD7A56D89593', 'Ntext') +INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (40, 1043, '7A2D436C-34C2-410F-898F-4A23B3D79F54', 'Ntext') + +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 [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 [umbracoAppTree] ADD CONSTRAINT [FK_umbracoAppTree_umbracoApp] FOREIGN KEY ([appAlias]) REFERENCES [umbracoApp] ([appAlias]) +ALTER TABLE [umbracoUser2app] ADD CONSTRAINT [FK_umbracoUser2app_umbracoApp] FOREIGN KEY ([app]) REFERENCES [umbracoApp] ([appAlias]) +ALTER TABLE [umbracoUser2app] ADD CONSTRAINT [FK_umbracoUser2app_umbracoUser] FOREIGN KEY ([user]) REFERENCES [umbracoUser] ([id]) +ALTER TABLE [cmsPropertyData] ADD CONSTRAINT [FK_cmsPropertyData_umbracoNode] FOREIGN KEY ([contentNodeId]) REFERENCES [umbracoNode] ([id]) + +/* TABLE IS NEVER USED, REMOVED FOR 4.1 + +ALTER TABLE [umbracoUser2userGroup] ADD CONSTRAINT [FK_user2userGroup_user] FOREIGN KEY ([user]) REFERENCES [umbracoUser] ([id]) +ALTER TABLE [umbracoUser2userGroup] ADD CONSTRAINT [FK_user2userGroup_userGroup] FOREIGN KEY ([userGroup]) REFERENCES [umbracoUserGroup] ([id]) + +*/ + +ALTER TABLE [umbracoUser] ADD CONSTRAINT [FK_user_userType] FOREIGN KEY ([userType]) REFERENCES [umbracoUserType] ([id]) +ALTER TABLE [cmsContentType] ADD CONSTRAINT [FK_cmsContentType_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id]) +ALTER TABLE [cmsDocument] ADD CONSTRAINT [FK_cmsDocument_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id]) +ALTER TABLE [umbracoNode] ADD CONSTRAINT [FK_umbracoNode_umbracoNode] FOREIGN KEY ([parentID]) REFERENCES [umbracoNode] ([id]) +; +set identity_insert umbracoNode on +insert into umbracoNode +(id, trashed, parentID, nodeUser, level, path, sortOrder, uniqueID, text, nodeObjectType) +values +(-20, 0, -1, 0, 0, '-1,-20', 0, '0F582A79-1E41-4CF0-BFA0-76340651891A', 'Recycle Bin', '01BB7FF2-24DC-4C0C-95A2-C24EF72BBAC8') +set identity_insert umbracoNode off +; +ALTER TABLE cmsDataTypePreValues ALTER COLUMN value NVARCHAR(2500) NULL +; +CREATE TABLE [cmsTask] +( +[closed] [bit] NOT NULL CONSTRAINT [DF__cmsTask__closed__04E4BC85] DEFAULT ((0)), +[id] [int] NOT NULL IDENTITY(1, 1), +[taskTypeId] [tinyint] NOT NULL, +[nodeId] [int] NOT NULL, +[parentUserId] [int] NOT NULL, +[userId] [int] NOT NULL, +[DateTime] [datetime] NOT NULL CONSTRAINT [DF__cmsTask__DateTim__05D8E0BE] DEFAULT (getdate()), +[Comment] [nvarchar] (500) NULL +) +; +ALTER TABLE [cmsTask] ADD CONSTRAINT [PK_cmsTask] PRIMARY KEY CLUSTERED ([id]) +; +CREATE TABLE [cmsTaskType] +( +[id] [tinyint] NOT NULL IDENTITY(1, 1), +[alias] [nvarchar] (255) NOT NULL +) +; +ALTER TABLE [cmsTaskType] ADD CONSTRAINT [PK_cmsTaskType] PRIMARY KEY CLUSTERED ([id]) +; +ALTER TABLE [cmsTask] ADD +CONSTRAINT [FK_cmsTask_cmsTaskType] FOREIGN KEY ([taskTypeId]) REFERENCES [cmsTaskType] ([id]) +; +insert into cmsTaskType (alias) values ('toTranslate') +; +/* Add send to translate actions to admins and editors */ +update umbracoUserType set userTypeDefaultPermissions = userTypeDefaultPermissions + '5' where userTypeAlias in ('editor','admin') +; +/* Add translator usertype */ +if not exists(select id from umbracoUserType where userTypeAlias = 'translator') +insert into umbracoUserType (userTypeAlias, userTypeName, userTypeDefaultPermissions) values ('translator', 'Translator', 'A') +; +insert into umbracoRelationType (dual, parentObjectType, childObjectType, name, alias) values (1, 'c66ba18e-eaf3-4cff-8a22-41b16d66a972', 'c66ba18e-eaf3-4cff-8a22-41b16d66a972', 'Relate Document On Copy','relateDocumentOnCopy') +; +ALTER TABLE cmsMacro ADD macroPython nvarchar(255) +; + +INSERT INTO [umbracoAppTree]([treeSilent], [treeInitialize], [treeSortOrder], [appAlias], [treeAlias], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES(0, 1, 4, 'developer', 'python', 'Python Files', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadPython') +; +INSERT INTO [umbracoAppTree]([treeSilent], [treeInitialize], [treeSortOrder], [appAlias], [treeAlias], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES(0, 1, 2, 'settings', 'scripts', 'Scripts', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadScripts') +; +alter TABLE [cmsContentType] +add [thumbnail] nvarchar(255) NOT NULL CONSTRAINT +[DF_cmsContentType_thumbnail] DEFAULT ('folder.png') +; +alter TABLE [cmsContentType] +add [description] nvarchar(1500) NULL +; +ALTER TABLE umbracoLog ALTER COLUMN logComment NVARCHAR(4000) NULL +; +SET IDENTITY_INSERT [cmsDataTypePreValues] ON +insert into cmsDataTypePreValues (id, dataTypeNodeId, [value], sortorder, alias) +values (3,-87,',code,undo,redo,cut,copy,mcepasteword,stylepicker,bold,italic,bullist,numlist,outdent,indent,mcelink,unlink,mceinsertanchor,mceimage,umbracomacro,mceinserttable,mcecharmap,' + char(124) + '1' + char(124) + '1,2,3,' + char(124) + '0' + char(124) + '500,400' + char(124) + '1049,' + char(124) + '', 0, '') + +insert into cmsDataTypePreValues (id, dataTypeNodeId, [value], sortorder, alias) +values (4,1041,'default', 0, 'group') + +SET IDENTITY_INSERT [cmsDataTypePreValues] OFF +; +/* 3.1 SQL changes */ +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'developer', N'packager', 0, 1, 3, N'Packages', N'folder.gif', N'folder_o.gif', N'umbraco', N'loadPackager') +; +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'developer', N'packagerPackages', 0, 0, 1, N'Packager Packages', N'folder.gif', N'folder_o.gif', N'umbraco', N'loadPackages'); + + +/* Add ActionBrowse as a default permission to all user types that have ActionUpdate */ +UPDATE umbracoUserType SET userTypeDefaultPermissions = userTypeDefaultPermissions + 'F' WHERE CHARINDEX('A',userTypeDefaultPermissions,0) >= 1 +AND CHARINDEX('F',userTypeDefaultPermissions,0) < 1 +; +/* Add ActionToPublish to all users types that have the alias 'writer' */ +UPDATE umbracoUserType SET userTypeDefaultPermissions = userTypeDefaultPermissions + 'H' WHERE userTypeAlias = 'writer' +AND CHARINDEX('F',userTypeDefaultPermissions,0) < 1 +; +/* Add ActionBrowse to all user permissions for nodes that have the ActionUpdate permission */ +IF NOT EXISTS (SELECT permission FROM umbracoUser2NodePermission WHERE permission='F') +INSERT INTO umbracoUser2NodePermission (userID, nodeId, permission) +SELECT userID, nodeId, 'F' FROM umbracoUser2NodePermission WHERE permission='A' +; +/* Add ActionToPublish permissions to all nodes for users that are of type 'writer' */ +IF NOT EXISTS (SELECT permission FROM umbracoUser2NodePermission WHERE permission='H') +INSERT INTO umbracoUser2NodePermission (userID, nodeId, permission) +SELECT DISTINCT userID, nodeId, 'H' FROM umbracoUser2NodePermission WHERE userId IN +(SELECT umbracoUser.id FROM umbracoUserType INNER JOIN umbracoUser ON umbracoUserType.id = umbracoUser.userType WHERE (umbracoUserType.userTypeAlias = 'writer')) +; +/* Add the contentRecycleBin tree type */ +IF NOT EXISTS (SELECT treeAlias FROM umbracoAppTree WHERE treeAlias='contentRecycleBin') +INSERT INTO umbracoAppTree (treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) +VALUES (0, 0, 0, 'content', 'contentRecycleBin', 'RecycleBin', 'folder.gif', 'folder_o.gif', 'umbraco', 'cms.presentation.Trees.ContentRecycleBin') +; +/* Add the UserType tree type */ +IF NOT EXISTS (SELECT treeAlias FROM umbracoAppTree WHERE treeAlias='userTypes') +INSERT INTO umbracoAppTree (treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) +VALUES (0, 1, 1, 'users', 'userTypes', 'User Types', 'folder.gif', 'folder_o.gif', 'umbraco', 'cms.presentation.Trees.UserTypes') +; +/* Add the User Permission tree type */ +IF NOT EXISTS (SELECT treeAlias FROM umbracoAppTree WHERE treeAlias='userPermissions') +INSERT INTO umbracoAppTree (treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) +VALUES (0, 1, 2, 'users', 'userPermissions', 'User Permissions', 'folder.gif', 'folder_o.gif', 'umbraco', 'cms.presentation.Trees.UserPermissions'); + + +/* TRANSLATION RELATED SQL */ +INSERT INTO [umbracoApp] ([appAlias], [sortOrder], [appIcon], [appName], [appInitWithTreeAlias]) VALUES (N'translation', 5, N'.traytranslation', N'Translation', NULL) +INSERT INTO umbracoAppTree (treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) +VALUES (0, 1, 1, 'translation','openTasks', 'Tasks assigned to you', '.sprTreeFolder', '.sprTreeFolder_o', 'umbraco', 'loadOpenTasks'); +INSERT INTO umbracoAppTree (treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) +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, + CONSTRAINT [PK_cmsTagRelationship] PRIMARY KEY CLUSTERED +( + [nodeId] ASC, + [tagId] ASC +) +) ON [PRIMARY] +; + +CREATE TABLE [cmsTags]( + [id] [int] IDENTITY(1,1) NOT NULL, + [tag] [varchar](200) NULL, + [parentId] [int] NULL, + [group] [varchar](100) NULL, + CONSTRAINT [PK_cmsTags] PRIMARY KEY CLUSTERED +( + [id] ASC +) +) ON [PRIMARY] +; + +ALTER TABLE [cmsTagRelationship] WITH CHECK ADD CONSTRAINT [umbracoNode_cmsTagRelationship] FOREIGN KEY([nodeId]) +REFERENCES [umbracoNode] ([id]) +ON DELETE CASCADE +; + +ALTER TABLE [cmsTagRelationship] CHECK CONSTRAINT [umbracoNode_cmsTagRelationship] +; + +ALTER TABLE [cmsTagRelationship] WITH CHECK ADD CONSTRAINT [cmsTags_cmsTagRelationship] FOREIGN KEY([tagId]) +REFERENCES [cmsTags] ([id]) +ON DELETE CASCADE +; + +ALTER TABLE [cmsTagRelationship] CHECK CONSTRAINT [cmsTags_cmsTagRelationship] +; +alter TABLE [umbracoUser] +add [defaultToLiveEditing] bit NOT NULL CONSTRAINT +[DF_umbracoUser_defaultToLiveEditing] DEFAULT (0) +; + +/* INSERT NEW MEDIA RECYCLE BIN NODE */ +SET IDENTITY_INSERT [umbracoNode] ON +INSERT INTO umbracoNode (id, trashed, parentID, nodeUser, level, path, sortOrder, uniqueID, text, nodeObjectType) +VALUES (-21, 0, -1, 0, 0, '-1,-21', 0, 'BF7C7CBC-952F-4518-97A2-69E9C7B33842', 'Recycle Bin', 'CF3D8E34-1C1C-41e9-AE56-878B57B32113') +SET IDENTITY_INSERT [umbracoNode] OFF +; +/* Add the mediaRecycleBin tree type */ +IF NOT EXISTS (SELECT treeAlias FROM umbracoAppTree WHERE treeAlias='mediaRecycleBin') +INSERT INTO umbracoAppTree (treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) +VALUES (0, 0, 0, 'media', 'mediaRecycleBin', 'RecycleBin', 'folder.gif', 'folder_o.gif', 'umbraco', 'cms.presentation.Trees.MediaRecycleBin') +; + +/* PREVIEW */ +CREATE TABLE [cmsPreviewXml]( + [nodeId] [int] NOT NULL, + [versionId] [uniqueidentifier] NOT NULL, + [timestamp] [datetime] NOT NULL, + [xml] [ntext] NOT NULL, + CONSTRAINT [PK_cmsContentPreviewXml] PRIMARY KEY CLUSTERED +( + [nodeId] ASC, + [versionId] ASC +) WITH ( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF) +) +; + + + + +/*********************************************************************************************************************** + +ADD NEW PRIMARY KEYS, FOREIGN KEYS AND INDEXES FOR VERSION 4.1 + +IMPORTANT!!!!! +YOU MUST MAKE SURE THAT THE SCRIPT BELOW THIS MATCHES THE KeysIndexesAndConstraints.sql FILE FOR THE MANUAL UPGRADE + +*/ + +/************************** CLEANUP ***********************************************/ + +/* DELETE NON-EXISTING DOCUMENTS */ +delete from cmsDocument where nodeId not in (select id from umbracoNode) +; + +/* CLEAN UNUSED CONTENT ROWS */ +delete from cmsContent where nodeId not in (select id from umbracoNode) +; + +/* CLEAN UNUSED VERSIONS */ +delete from cmsContentVersion where contentid not in (select nodeId from cmsContent) +; + +/* CLEAN UNUSED XML */ +delete from cmsContentXml where nodeid not in (select nodeId from cmsContent) +; + +/* CLEAN UNUSED DOCUMENT TYPES */ +delete from cmsDocumentType where contentTypeNodeId not in (select nodeId from cmsContentType) +; +delete from cmsDocumentType where templateNodeId not in (select nodeid from cmsTemplate) +; + +/* UPDATE EMPTY TEMPLATE REFERENCES IN DOCUMENTS */ +update cmsDocument set templateId = NULL where templateId not in (select nodeId from cmsTemplate) +; + +/* DELETE ALL NOTIFICATIONS THAT NO LONGER HAVE NODES */ +delete from umbracoUser2NodeNotify where nodeId not in (select id from umbracoNode) +; + +/* DELETE ALL NOTIFICATIONS THAT NO LONGER HAVE USERS */ +delete from umbracoUser2NodeNotify where userId not in (select id from umbracoUser) +; + +/* DELETE UMBRACO NODE DATA THAT IS FLAGGED AS A DOCUMENT OBJECT TYPE THAT DOESN'T EXIST IN THE CONTENT TABLE ANY LONGER */ +delete from umbracoNode where id not in +(select nodeId from cmsContent) and nodeObjectType = 'c66ba18e-eaf3-4cff-8a22-41b16d66a972' +; + +/* DELETE PERMISSIONS THAT RELATED TO NON-EXISTING USERS */ +delete from umbracoUser2NodePermission where userId not in (select id from umbracoUser) +; + +/* DELETE PERMISSIONS THAT RELATED TO NON-EXISTING NODES */ +delete from umbracoUser2NodePermission where nodeId not in (select id from umbracoNode) +; + +/* SET MASTER TEMPLATE TO NULL WHEN THERE ISN'T ONE SPECIFIED */ +update cmsTemplate set [master] = NULL where [master] = 0 + +/* +We need to remove any data type that doesn't exist in umbracoNode as these shouldn't actually exist +I think they must be left over from how Umbraco used to show the types of data types registered instead +of using reflection. Here are the data types in the cmsDataType table that are not in umbracoNode: + +12 -91 A74EA9C9-8E18-4D2A-8CF6-73C6206C5DA6 Nvarchar +22 -44 A3776494-0574-4D93-B7DE-EFDFDEC6F2D1 Ntext +23 -128 A52C7C1C-C330-476E-8605-D63D3B84B6A6 Nvarchar +24 -129 928639ED-9C73-4028-920C-1E55DBB68783 Nvarchar +25 -130 A74EA9C9-8E18-4D2A-8CF6-73C6206C5DA6 Nvarchar +26 -131 A74EA9C9-8E18-4D2A-8CF6-73C6206C5DA6 Nvarchar +27 -132 A74EA9C9-8E18-4D2A-8CF6-73C6206C5DA6 Nvarchar +28 -133 6C738306-4C17-4D88-B9BD-6546F3771597 Ntext +29 -134 928639ED-9C73-4028-920C-1E55DBB68783 Nvarchar +30 -50 AAF99BB2-DBBE-444D-A296-185076BF0484 Date +39 1042 5E9B75AE-FACE-41C8-B47E-5F4B0FD82F83 Ntext +40 1043 5E9B75AE-FACE-41C8-B47E-5F4B0FD82F83 Ntext +41 1044 A74EA9C9-8E18-4D2A-8CF6-73C6206C5DA6 Ntext +42 1045 A74EA9C9-8E18-4D2A-8CF6-73C6206C5DA6 Ntext +47 1194 D15E1281-E456-4B24-AA86-1DDA3E4299D5 Ntext + +*/ +DELETE FROM cmsDataType WHERE nodeId NOT IN (SELECT id FROM umbracoNode) +; + +/* Need to remove any data type prevalues that aren't related to a data type */ +DELETE FROM cmsDataTypePreValues WHERE dataTypeNodeID NOT IN (SELECT nodeId FROM cmsDataType) +; + +/* Remove any domains that should not exist as they weren't deleted before when documents were deleted */ +DELETE FROM umbracoDomains WHERE domainRootStructureId NOT IN (SELECT id FROM umbracoNode) +; + +-- It would be good to add constraints from cmsLanguageText to umbracoLanguage but unfortunately, a 'zero' id +-- is entered into cmsLanguageText when a new entry is made, since there's not language with id of zero this won't work. +-- However, we need to remove translations that aren't related to a language (these would be left over from deleting a language) +DELETE FROM cmsLanguageText +WHERE languageId <> 0 AND languageId NOT IN (SELECT id FROM umbracoLanguage) +; + +/* need to remove any content restrictions that don't exist in cmsContent */ + +DELETE FROM cmsContentTypeAllowedContentType WHERE id NOT IN (SELECT nodeId FROM cmsContentType) +; +DELETE FROM cmsContentTypeAllowedContentType WHERE Allowedid NOT IN (SELECT nodeId FROM cmsContentType) +; + +/* Though this should not have to be run because it's a new install, you need to clean the previews if you've been testing before the RC */ +DELETE FROM cmsPreviewXml WHERE VersionID NOT IN (SELECT VersionId FROM cmsContentVersion) +; + +/* Though this should not have to run because it's a new install, you need to remove this constraint if you've been testing with the RC */ +/*IF EXISTS (SELECT name FROM sysindexes WHERE name = 'IX_cmsMemberType')*/ +/*ALTER TABLE [cmsMemberType] DROP CONSTRAINT [IX_cmsMemberType]*/ + +/************************** CLEANUP END ********************************************/ + + +/* Create missing indexes and primary keys */ +CREATE NONCLUSTERED INDEX [IX_Icon] ON CMSContenttype(nodeId, Icon) +; + +ALTER TABLE cmsContentType ADD CONSTRAINT + IX_cmsContentType UNIQUE NONCLUSTERED + ( + nodeId + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +; + +ALTER TABLE cmsContent ADD CONSTRAINT + IX_cmsContent UNIQUE NONCLUSTERED + ( + nodeId + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +; + +ALTER TABLE cmsContentVersion ADD CONSTRAINT + FK_cmsContentVersion_cmsContent FOREIGN KEY + ( + ContentId + ) REFERENCES cmsContent + ( + nodeId + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsMember ADD CONSTRAINT + PK_cmsMember PRIMARY KEY CLUSTERED + ( + nodeId + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +; + +ALTER TABLE cmsMember ADD CONSTRAINT + FK_cmsMember_cmsContent FOREIGN KEY + ( + nodeId + ) REFERENCES cmsContent + ( + nodeId + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsMember ADD CONSTRAINT + FK_cmsMember_umbracoNode FOREIGN KEY + ( + nodeId + ) REFERENCES umbracoNode + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsStylesheet ADD CONSTRAINT + PK_cmsStylesheet PRIMARY KEY CLUSTERED + ( + nodeId + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +; + +ALTER TABLE cmsStylesheetProperty ADD CONSTRAINT + PK_cmsStylesheetProperty PRIMARY KEY CLUSTERED + ( + nodeId + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +; + +ALTER TABLE cmsStylesheetProperty ADD CONSTRAINT + FK_cmsStylesheetProperty_umbracoNode FOREIGN KEY + ( + nodeId + ) REFERENCES umbracoNode + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsStylesheet ADD CONSTRAINT + FK_cmsStylesheet_umbracoNode FOREIGN KEY + ( + nodeId + ) REFERENCES umbracoNode + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsContentXml ADD CONSTRAINT + FK_cmsContentXml_cmsContent FOREIGN KEY + ( + nodeId + ) REFERENCES cmsContent + ( + nodeId + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsDataType ADD CONSTRAINT + IX_cmsDataType UNIQUE NONCLUSTERED + ( + nodeId + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +; + + + +ALTER TABLE cmsDataType ADD CONSTRAINT + FK_cmsDataType_umbracoNode FOREIGN KEY + ( + nodeId + ) REFERENCES umbracoNode + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + + + +ALTER TABLE cmsDataTypePreValues ADD CONSTRAINT + FK_cmsDataTypePreValues_cmsDataType FOREIGN KEY + ( + datatypeNodeId + ) REFERENCES cmsDataType + ( + nodeId + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsDocument ADD CONSTRAINT + FK_cmsDocument_cmsContent FOREIGN KEY + ( + nodeId + ) REFERENCES cmsContent + ( + nodeId + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsDocumentType ADD CONSTRAINT + FK_cmsDocumentType_cmsContentType FOREIGN KEY + ( + contentTypeNodeId + ) REFERENCES cmsContentType + ( + nodeId + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsDocumentType ADD CONSTRAINT + FK_cmsDocumentType_umbracoNode FOREIGN KEY + ( + contentTypeNodeId + ) REFERENCES umbracoNode + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsMacroProperty ADD CONSTRAINT + FK_cmsMacroProperty_cmsMacro FOREIGN KEY + ( + macro + ) REFERENCES cmsMacro + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsMemberType ADD CONSTRAINT + FK_cmsMemberType_cmsContentType FOREIGN KEY + ( + NodeId + ) REFERENCES cmsContentType + ( + nodeId + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsMemberType ADD CONSTRAINT + FK_cmsMemberType_umbracoNode FOREIGN KEY + ( + NodeId + ) REFERENCES umbracoNode + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsMember2MemberGroup ADD CONSTRAINT + FK_cmsMember2MemberGroup_cmsMember FOREIGN KEY + ( + Member + ) REFERENCES cmsMember + ( + nodeId + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsDocument ADD CONSTRAINT + IX_cmsDocument UNIQUE NONCLUSTERED + ( + nodeId, + versionId + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +; + +ALTER TABLE cmsPropertyData ADD CONSTRAINT + FK_cmsPropertyData_cmsPropertyType FOREIGN KEY + ( + propertytypeid + ) REFERENCES cmsPropertyType + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsPropertyType ADD CONSTRAINT + FK_cmsPropertyType_cmsContentType FOREIGN KEY + ( + contentTypeId + ) REFERENCES cmsContentType + ( + nodeId + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsPropertyType ADD CONSTRAINT + FK_cmsPropertyType_cmsDataType FOREIGN KEY + ( + dataTypeId + ) REFERENCES cmsDataType + ( + nodeId + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsTab ADD CONSTRAINT + FK_cmsTab_cmsContentType FOREIGN KEY + ( + contenttypeNodeId + ) REFERENCES cmsContentType + ( + nodeId + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsTemplate ADD CONSTRAINT + IX_cmsTemplate UNIQUE NONCLUSTERED + ( + nodeId + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +; + +ALTER TABLE cmsDocument ADD CONSTRAINT + FK_cmsDocument_cmsTemplate FOREIGN KEY + ( + templateId + ) REFERENCES cmsTemplate + ( + nodeId + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + + +ALTER TABLE umbracoDomains ADD CONSTRAINT + FK_umbracoDomains_umbracoNode FOREIGN KEY + ( + domainRootStructureID + ) REFERENCES umbracoNode + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsDictionary ADD CONSTRAINT + IX_cmsDictionary UNIQUE NONCLUSTERED + ( + id + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +; + +ALTER TABLE cmsLanguageText ADD CONSTRAINT + FK_cmsLanguageText_cmsDictionary FOREIGN KEY + ( + UniqueId + ) REFERENCES cmsDictionary + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + + + +ALTER TABLE umbracoUser2NodeNotify ADD CONSTRAINT + FK_umbracoUser2NodeNotify_umbracoUser FOREIGN KEY + ( + userId + ) REFERENCES umbracoUser + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE umbracoUser2NodeNotify ADD CONSTRAINT + FK_umbracoUser2NodeNotify_umbracoNode FOREIGN KEY + ( + nodeId + ) REFERENCES umbracoNode + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE umbracoUser2NodePermission ADD CONSTRAINT + FK_umbracoUser2NodePermission_umbracoUser FOREIGN KEY + ( + userId + ) REFERENCES umbracoUser + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE umbracoUser2NodePermission ADD CONSTRAINT + FK_umbracoUser2NodePermission_umbracoNode FOREIGN KEY + ( + nodeId + ) REFERENCES umbracoNode + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsTask ADD CONSTRAINT + FK_cmsTask_umbracoUser FOREIGN KEY + ( + parentUserId + ) REFERENCES umbracoUser + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsTask ADD CONSTRAINT + FK_cmsTask_umbracoUser1 FOREIGN KEY + ( + userId + ) REFERENCES umbracoUser + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsTask ADD CONSTRAINT + FK_cmsTask_umbracoNode FOREIGN KEY + ( + nodeId + ) REFERENCES umbracoNode + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +CREATE NONCLUSTERED INDEX IX_umbracoLog ON umbracoLog + ( + NodeId + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +; + +ALTER TABLE umbracoRelation ADD CONSTRAINT + FK_umbracoRelation_umbracoRelationType FOREIGN KEY + ( + relType + ) REFERENCES umbracoRelationType + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE umbracoRelation ADD CONSTRAINT + FK_umbracoRelation_umbracoNode FOREIGN KEY + ( + parentId + ) REFERENCES umbracoNode + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE umbracoRelation ADD CONSTRAINT + FK_umbracoRelation_umbracoNode1 FOREIGN KEY + ( + childId + ) REFERENCES umbracoNode + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + + + +ALTER TABLE cmsContentTypeAllowedContentType ADD CONSTRAINT + FK_cmsContentTypeAllowedContentType_cmsContentType FOREIGN KEY + ( + Id + ) REFERENCES cmsContentType + ( + nodeId + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsContentTypeAllowedContentType ADD CONSTRAINT + FK_cmsContentTypeAllowedContentType_cmsContentType1 FOREIGN KEY + ( + AllowedId + ) REFERENCES cmsContentType + ( + nodeId + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE umbracoLanguage ADD CONSTRAINT + IX_umbracoLanguage UNIQUE NONCLUSTERED + ( + languageISOCode + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +; + +ALTER TABLE umbracoUser ADD CONSTRAINT + IX_umbracoUser UNIQUE NONCLUSTERED + ( + userLogin + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +; + +ALTER TABLE cmsTaskType ADD CONSTRAINT + IX_cmsTaskType UNIQUE NONCLUSTERED + ( + alias + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +; + +ALTER TABLE cmsDocumentType ADD CONSTRAINT + FK_cmsDocumentType_cmsTemplate FOREIGN KEY + ( + templateNodeId + ) REFERENCES cmsTemplate + ( + nodeId + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsTemplate ADD CONSTRAINT + FK_cmsTemplate_cmsTemplate FOREIGN KEY + ( + master + ) REFERENCES cmsTemplate + ( + nodeId + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsContentVersion ADD CONSTRAINT + IX_cmsContentVersion UNIQUE NONCLUSTERED + ( + VersionId + ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +; + +ALTER TABLE cmsPreviewXml ADD CONSTRAINT + FK_cmsPreviewXml_cmsContentVersion FOREIGN KEY + ( + versionId + ) REFERENCES cmsContentVersion + ( + VersionId + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + +ALTER TABLE cmsPreviewXml ADD CONSTRAINT + FK_cmsPreviewXml_cmsContent FOREIGN KEY + ( + nodeId + ) REFERENCES cmsContent + ( + nodeId + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + + +ALTER TABLE cmsMember2MemberGroup ADD CONSTRAINT + FK_cmsMember2MemberGroup_umbracoNode FOREIGN KEY + ( + MemberGroup + ) REFERENCES umbracoNode + ( + id + ) ON UPDATE NO ACTION + ON DELETE NO ACTION +; + + +/*********************************************************************************************************************** + +END OF NEW CONSTRAINTS + +***********************************************************************************************************************/ \ No newline at end of file diff --git a/src/Umbraco.Tests/Migrations/TargetVersionSixthMigrationsTest.cs b/src/Umbraco.Tests/Migrations/TargetVersionSixthMigrationsTest.cs new file mode 100644 index 0000000000..5422c3c06d --- /dev/null +++ b/src/Umbraco.Tests/Migrations/TargetVersionSixthMigrationsTest.cs @@ -0,0 +1,70 @@ +using System; +using System.Linq; +using NUnit.Framework; +using Umbraco.Core; +using Umbraco.Core.Persistence.Migrations; +using Umbraco.Core.Persistence.SqlSyntax; +using Umbraco.Tests.TestHelpers; + +namespace Umbraco.Tests.Migrations +{ + [TestFixture] + public class TargetVersionSixthMigrationsTest + { + [SetUp] + public void Initialize() + { + TestHelper.SetupLog4NetForTests(); + + //this ensures its reset + PluginManager.Current = new PluginManager(false); + + //for testing, we'll specify which assemblies are scanned for the PluginTypeResolver + PluginManager.Current.AssembliesToScan = new[] + { + typeof (MigrationRunner).Assembly + }; + + SyntaxConfig.SqlSyntaxProvider = SqlCeSyntax.Provider; + } + + [Test] + public void Can_Find_Migrations_In_Current_Assembly() + { + var foundTypes = PluginManager.Current.ResolveMigrationTypes(); + + Assert.That(foundTypes.Any(), Is.True); + Assert.That(foundTypes.Count(), Is.GreaterThanOrEqualTo(11)); + } + + [Test] + public void Can_Find_Targetted_Migrations() + { + var configuredVersion = new Version("4.11.0"); + var targetVersion = new Version("6.0.0"); + var foundMigrations = PluginManager.Current.FindMigrations(); + + var migrationRunner = new MigrationRunner(configuredVersion, targetVersion); + var migrations = migrationRunner.OrderedUpgradeMigrations(foundMigrations); + + var context = new MigrationContext(); + foreach (MigrationBase migration in migrations) + { + migration.GetUpExpressions(context); + } + + foreach (var expression in context.Expressions) + { + Console.WriteLine(expression.ToString()); + } + + Assert.That(migrations.Count(), Is.EqualTo(11)); + } + + [TearDown] + public void TearDown() + { + PluginManager.Current = null; + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/TestHelpers/BaseDatabaseTest.cs b/src/Umbraco.Tests/TestHelpers/BaseDatabaseTest.cs index cb9dd95e11..856bef3e86 100644 --- a/src/Umbraco.Tests/TestHelpers/BaseDatabaseTest.cs +++ b/src/Umbraco.Tests/TestHelpers/BaseDatabaseTest.cs @@ -30,6 +30,8 @@ namespace Umbraco.Tests.TestHelpers TestHelper.SetupLog4NetForTests(); TestHelper.InitializeContentDirectories(); + UmbracoSettings.UseLegacyXmlSchema = false; + string path = TestHelper.CurrentAssemblyDirectory; AppDomain.CurrentDomain.SetData("DataDirectory", path); @@ -48,8 +50,6 @@ namespace Umbraco.Tests.TestHelpers engine.CreateDatabase(); } - UmbracoSettings.UseLegacyXmlSchema = false; - RepositoryResolver.Current = new RepositoryResolver( new RepositoryFactory()); diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index efe31df9fe..654de72da1 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -160,10 +160,17 @@ + + + True + True + SqlResources.resx + + @@ -343,6 +350,10 @@ + + ResXFileCodeGenerator + SqlResources.Designer.cs + ResXFileCodeGenerator ExamineResources.Designer.cs @@ -376,7 +387,11 @@ true - + + + + + xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.0\amd64\*.* "$(TargetDir)amd64\" /Y /F /E /D diff --git a/src/Umbraco.Web/Strategies/EnsureAppsTreesUpdatedOnUpgrade.cs b/src/Umbraco.Web/Strategies/EnsureAppsTreesUpdatedOnUpgrade.cs new file mode 100644 index 0000000000..6ccf84207e --- /dev/null +++ b/src/Umbraco.Web/Strategies/EnsureAppsTreesUpdatedOnUpgrade.cs @@ -0,0 +1,25 @@ +using Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSixth; +using umbraco.BusinessLogic; +using umbraco.interfaces; + +namespace Umbraco.Web.Strategies +{ + /// + /// This is kind of a hack to ensure that Apps and Trees that might still reside in the db is + /// written to the 'new' applications.config and trees.config files upon upgrade to version 6.0 + /// + public class EnsureAppsTreesUpdatedOnUpgrade : IApplicationStartupHandler + { + public EnsureAppsTreesUpdatedOnUpgrade() + { + //This event will be triggered once the EnsureAppsTreesUpdated Up() method is run during upgrades + EnsureAppsTreesUpdated.Upgrading += EnsureAppsTreesUpdated_Upgrading; + } + + void EnsureAppsTreesUpdated_Upgrading(object sender, EnsureAppsTreesUpdated.UpgradingEventArgs e) + { + var treeRegistrar = new ApplicationTreeRegistrar(); + var appRegistrar = new ApplicationRegistrar(); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index bfc30126df..39c6467825 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -326,6 +326,7 @@ + @@ -2181,9 +2182,7 @@ umbraco_org_umbraco_update_CheckForUpgrade - - - + 10.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)