diff --git a/.gitignore b/.gitignore index b87d1df346..022acb5db7 100644 --- a/.gitignore +++ b/.gitignore @@ -196,3 +196,4 @@ src/Umbraco.Tests.Integration/umbraco/logs/ src/Umbraco.Tests.Integration/Views/ src/Umbraco.Tests/TEMP/ +/src/Umbraco.Web.UI.NetCore/Umbraco/Data/* diff --git a/src/Umbraco.Core/Configuration/LocalTempStorage.cs b/src/Umbraco.Core/Configuration/LocalTempStorage.cs index 0013fb68e4..50eab639d0 100644 --- a/src/Umbraco.Core/Configuration/LocalTempStorage.cs +++ b/src/Umbraco.Core/Configuration/LocalTempStorage.cs @@ -4,7 +4,6 @@ namespace Umbraco.Core.Configuration { Unknown = 0, Default, - AspNetTemp, EnvironmentTemp } } diff --git a/src/Umbraco.Core/Constants-SystemDirectories.cs b/src/Umbraco.Core/Constants-SystemDirectories.cs index d4ca2a3c57..6145f4190b 100644 --- a/src/Umbraco.Core/Constants-SystemDirectories.cs +++ b/src/Umbraco.Core/Constants-SystemDirectories.cs @@ -1,15 +1,33 @@ -namespace Umbraco.Core +namespace Umbraco.Core { public static partial class Constants { public static class SystemDirectories { + /// + /// The aspnet bin folder + /// public const string Bin = "~/bin"; + // TODO: Shouldn't this exist underneath /Umbraco in the content root? public const string Config = "~/config"; - public const string Data = "~/App_Data"; + /// + /// The Umbraco folder that exists at the content root. + /// + /// + /// This is not the same as the Umbraco web folder which is configurable for serving front-end files. + /// + public const string Umbraco = "~/Umbraco"; + /// + /// The Umbraco data folder in the content root + /// + public const string Data = Umbraco + "/Data"; + + /// + /// The Umbraco temp data folder in the content root + /// public const string TempData = Data + "/TEMP"; public const string TempFileUploads = TempData + "/FileUploads"; @@ -18,8 +36,6 @@ public const string Install = "~/install"; - public const string AppCode = "~/App_Code"; - public const string AppPlugins = "/App_Plugins"; public const string MvcViews = "~/Views"; @@ -32,7 +48,10 @@ public const string Preview = Data + "/preview"; - public const string LogFiles= "~/Logs"; + /// + /// The default folder where Umbraco log files are stored + /// + public const string LogFiles = Umbraco + "/Logs"; } } } diff --git a/src/Umbraco.Core/Diagnostics/MiniDump.cs b/src/Umbraco.Core/Diagnostics/MiniDump.cs index 56635c6b46..51f595bfb2 100644 --- a/src/Umbraco.Core/Diagnostics/MiniDump.cs +++ b/src/Umbraco.Core/Diagnostics/MiniDump.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; @@ -111,11 +111,14 @@ namespace Umbraco.Core.Diagnostics // filter everywhere in our code = not! var stacktrace = withException ? Environment.StackTrace : string.Empty; - var filepath = Path.Combine(hostingEnvironment.ApplicationPhysicalPath, "App_Data/MiniDump"); - if (Directory.Exists(filepath) == false) - Directory.CreateDirectory(filepath); + var directory = hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.Data + "/MiniDump"); - var filename = Path.Combine(filepath, $"{DateTime.UtcNow:yyyyMMddTHHmmss}.{Guid.NewGuid().ToString("N").Substring(0, 4)}.dmp"); + if (Directory.Exists(directory) == false) + { + Directory.CreateDirectory(directory); + } + + var filename = Path.Combine(directory, $"{DateTime.UtcNow:yyyyMMddTHHmmss}.{Guid.NewGuid().ToString("N").Substring(0, 4)}.dmp"); using (var stream = new FileStream(filename, FileMode.Create, FileAccess.ReadWrite, FileShare.Write)) { return Write(marchal, stream.SafeFileHandle, options, withException); @@ -127,9 +130,12 @@ namespace Umbraco.Core.Diagnostics { lock (LockO) { - var filepath = Path.Combine(hostingEnvironment.ApplicationPhysicalPath, "App_Data/MiniDump"); - if (Directory.Exists(filepath) == false) return true; - var count = Directory.GetFiles(filepath, "*.dmp").Length; + var directory = hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.Data + "/MiniDump"); + if (Directory.Exists(directory) == false) + { + return true; + } + var count = Directory.GetFiles(directory, "*.dmp").Length; return count < 8; } } diff --git a/src/Umbraco.Core/HealthCheck/Checks/Permissions/FolderAndFilePermissionsCheck.cs b/src/Umbraco.Core/HealthCheck/Checks/Permissions/FolderAndFilePermissionsCheck.cs index 9e279c98e2..a22748094a 100644 --- a/src/Umbraco.Core/HealthCheck/Checks/Permissions/FolderAndFilePermissionsCheck.cs +++ b/src/Umbraco.Core/HealthCheck/Checks/Permissions/FolderAndFilePermissionsCheck.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using Microsoft.Extensions.Options; @@ -71,7 +71,6 @@ namespace Umbraco.Core.HealthCheck.Checks.Permissions //so these need to be tested differently var pathsToCheckWithRestarts = new Dictionary { - { Constants.SystemDirectories.AppCode, PermissionCheckRequirement.Optional }, { Constants.SystemDirectories.Bin, PermissionCheckRequirement.Optional } }; diff --git a/src/Umbraco.Core/Hosting/IHostingEnvironment.cs b/src/Umbraco.Core/Hosting/IHostingEnvironment.cs index 188fb87b55..60d582c6c9 100644 --- a/src/Umbraco.Core/Hosting/IHostingEnvironment.cs +++ b/src/Umbraco.Core/Hosting/IHostingEnvironment.cs @@ -5,6 +5,7 @@ namespace Umbraco.Core.Hosting public interface IHostingEnvironment { string SiteName { get; } + string ApplicationId { get; } /// @@ -35,8 +36,6 @@ namespace Umbraco.Core.Hosting /// /// Maps a virtual path to a physical path to the application's web root /// - /// - /// /// /// Depending on the runtime 'web root', this result can vary. For example in Net Framework the web root and the content root are the same, however /// in netcore the web root is /www therefore this will Map to a physical path within www. @@ -46,8 +45,6 @@ namespace Umbraco.Core.Hosting /// /// Maps a virtual path to a physical path to the application's root (not always equal to the web root) /// - /// - /// /// /// Depending on the runtime 'web root', this result can vary. For example in Net Framework the web root and the content root are the same, however /// in netcore the web root is /www therefore this will Map to a physical path within www. @@ -58,7 +55,6 @@ namespace Umbraco.Core.Hosting /// Converts a virtual path to an absolute URL path based on the application's web root /// /// The virtual path. Must start with either ~/ or / else an exception is thrown. - /// /// /// This maps the virtual path syntax to the web root. For example when hosting in a virtual directory called "site" and the value "~/pages/test" is passed in, it will /// map to "/site/pages/test" where "/site" is the value of . diff --git a/src/Umbraco.Core/Logging/ILoggingConfiguration.cs b/src/Umbraco.Core/Logging/ILoggingConfiguration.cs index d21a08e688..6590f9fc65 100644 --- a/src/Umbraco.Core/Logging/ILoggingConfiguration.cs +++ b/src/Umbraco.Core/Logging/ILoggingConfiguration.cs @@ -1,10 +1,10 @@ -namespace Umbraco.Core.Logging +namespace Umbraco.Core.Logging { public interface ILoggingConfiguration { /// - /// The physical path where logs are stored + /// Gets the physical path where logs are stored /// string LogDirectory { get; } } diff --git a/src/Umbraco.Core/PublishedCache/IPublishedSnapshotService.cs b/src/Umbraco.Core/PublishedCache/IPublishedSnapshotService.cs index b23c8ae10f..68b2367ce0 100644 --- a/src/Umbraco.Core/PublishedCache/IPublishedSnapshotService.cs +++ b/src/Umbraco.Core/PublishedCache/IPublishedSnapshotService.cs @@ -1,10 +1,11 @@ -using System; +using System; using System.Collections.Generic; using Umbraco.Core.Models.Membership; using Umbraco.Web.Cache; namespace Umbraco.Web.PublishedCache { + /// /// Creates and manages instances. /// diff --git a/src/Umbraco.Infrastructure/Logging/Serilog/LoggerConfigExtensions.cs b/src/Umbraco.Infrastructure/Logging/Serilog/LoggerConfigExtensions.cs index 84270b95bf..5481f22cb6 100644 --- a/src/Umbraco.Infrastructure/Logging/Serilog/LoggerConfigExtensions.cs +++ b/src/Umbraco.Infrastructure/Logging/Serilog/LoggerConfigExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Text; using Serilog; @@ -127,7 +127,7 @@ namespace Umbraco.Core.Logging.Serilog /// Outputs a CLEF format JSON log at /App_Data/Logs/ /// /// A Serilog LoggerConfiguration - /// + /// The logging configuration /// The log level you wish the JSON file to collect - default is Verbose (highest) /// The number of days to keep log files. Default is set to null which means all logs are kept public static LoggerConfiguration OutputDefaultJsonFile( @@ -135,13 +135,13 @@ namespace Umbraco.Core.Logging.Serilog IHostingEnvironment hostingEnvironment, ILoggingConfiguration loggingConfiguration, LogEventLevel minimumLevel = LogEventLevel.Verbose, int? retainedFileCount = null) { - //.clef format (Compact log event format, that can be imported into local SEQ & will make searching/filtering logs easier) - //Ends with ..txt as Date is inserted before file extension substring + // .clef format (Compact log event format, that can be imported into local SEQ & will make searching/filtering logs easier) + // Ends with ..txt as Date is inserted before file extension substring logConfig.WriteTo.File(new CompactJsonFormatter(), Path.Combine(hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.LogFiles) ,$"UmbracoTraceLog.{Environment.MachineName}..json"), shared: true, - rollingInterval: RollingInterval.Day, //Create a new JSON file every day - retainedFileCountLimit: retainedFileCount, //Setting to null means we keep all files - default is 31 days + rollingInterval: RollingInterval.Day, // Create a new JSON file every day + retainedFileCountLimit: retainedFileCount, // Setting to null means we keep all files - default is 31 days restrictedToMinimumLevel: minimumLevel); return logConfig; diff --git a/src/Umbraco.Infrastructure/Migrations/Install/DatabaseBuilder.cs b/src/Umbraco.Infrastructure/Migrations/Install/DatabaseBuilder.cs index b27bc48c8e..98e9bcb4bb 100644 --- a/src/Umbraco.Infrastructure/Migrations/Install/DatabaseBuilder.cs +++ b/src/Umbraco.Infrastructure/Migrations/Install/DatabaseBuilder.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Linq; using System.Xml.Linq; @@ -462,7 +462,7 @@ namespace Umbraco.Core.Migrations.Install { Message = "The database configuration failed with the following message: " + ex.Message + - "\n Please check log file for additional information (can be found in '/App_Data/Logs/')", + $"\n Please check log file for additional information (can be found in '{Constants.SystemDirectories.LogFiles}')", Success = false, Percentage = "90" }; diff --git a/src/Umbraco.PublishedCache.NuCache/PublishedSnapshotService.cs b/src/Umbraco.PublishedCache.NuCache/PublishedSnapshotService.cs index 2b80b32b71..97e3df16a6 100644 --- a/src/Umbraco.PublishedCache.NuCache/PublishedSnapshotService.cs +++ b/src/Umbraco.PublishedCache.NuCache/PublishedSnapshotService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.IO; @@ -81,8 +81,6 @@ namespace Umbraco.Web.PublishedCache.NuCache #region Constructors - //private static int _singletonCheck; - public PublishedSnapshotService( PublishedSnapshotServiceOptions options, IMainDom mainDom, @@ -110,9 +108,6 @@ namespace Umbraco.Web.PublishedCache.NuCache IOptions config) : base(publishedSnapshotAccessor, variationContextAccessor) { - //if (Interlocked.Increment(ref _singletonCheck) > 1) - // throw new Exception("Singleton must be instantiated only once!"); - _options = options; _mainDom = mainDom; _lifeTime = lifeTime; diff --git a/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj b/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj index edb68c6b93..9f63604b0e 100644 --- a/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj +++ b/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj @@ -21,12 +21,15 @@ - - <_Parameter1>Umbraco.Tests - + + <_Parameter1>Umbraco.Tests + + + <_Parameter1>Umbraco.Tests.UnitTests + <_Parameter1>Umbraco.Tests.Integration - + <_Parameter1>Umbraco.Tests.Benchmarks diff --git a/src/Umbraco.Tests.Common/TestHelperBase.cs b/src/Umbraco.Tests.Common/TestHelperBase.cs index 24759f9ffb..ed3e28ee21 100644 --- a/src/Umbraco.Tests.Common/TestHelperBase.cs +++ b/src/Umbraco.Tests.Common/TestHelperBase.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Reflection; using Microsoft.Extensions.DependencyInjection; @@ -48,7 +48,7 @@ namespace Umbraco.Tests.Common public TypeLoader GetMockedTypeLoader() { - return new TypeLoader(Mock.Of(), Mock.Of(), new DirectoryInfo(GetHostingEnvironment().MapPathContentRoot("~/App_Data/TEMP")), Mock.Of>(), Mock.Of()); + return new TypeLoader(Mock.Of(), Mock.Of(), new DirectoryInfo(GetHostingEnvironment().MapPathContentRoot(Constants.SystemDirectories.TempData)), Mock.Of>(), Mock.Of()); } // public Configs GetConfigs() => GetConfigsFactory().Create(); diff --git a/src/Umbraco.Tests/Testing/TestDatabase.cs b/src/Umbraco.Tests.Common/TestHelpers/TestDatabase.cs similarity index 99% rename from src/Umbraco.Tests/Testing/TestDatabase.cs rename to src/Umbraco.Tests.Common/TestHelpers/TestDatabase.cs index 7d58433a52..d1e5669100 100644 --- a/src/Umbraco.Tests/Testing/TestDatabase.cs +++ b/src/Umbraco.Tests.Common/TestHelpers/TestDatabase.cs @@ -11,7 +11,6 @@ using NPoco.DatabaseTypes; using NPoco.Linq; using Umbraco.Core.Persistence; using Umbraco.Core.Persistence.SqlSyntax; -using Umbraco.Persistance.SqlCe; namespace Umbraco.Tests.Testing { @@ -33,8 +32,8 @@ namespace Umbraco.Tests.Testing /// public TestDatabase(DatabaseType databaseType = null, ISqlSyntaxProvider syntaxProvider = null) { - DatabaseType = databaseType ?? new SqlServerCEDatabaseType(); - SqlContext = new SqlContext(syntaxProvider ?? new SqlCeSyntaxProvider(), DatabaseType, Mock.Of()); + DatabaseType = databaseType ?? new SqlServerDatabaseType(); + SqlContext = new SqlContext(syntaxProvider ?? new SqlServerSyntaxProvider(), DatabaseType, Mock.Of()); } /// diff --git a/src/Umbraco.Tests/Migrations/AdvancedMigrationTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Migrations/AdvancedMigrationTests.cs similarity index 97% rename from src/Umbraco.Tests/Migrations/AdvancedMigrationTests.cs rename to src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Migrations/AdvancedMigrationTests.cs index 474528a8ec..ac502ddf80 100644 --- a/src/Umbraco.Tests/Migrations/AdvancedMigrationTests.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Migrations/AdvancedMigrationTests.cs @@ -5,6 +5,7 @@ using Microsoft.Extensions.Logging.Abstractions; using Moq; using NUnit.Framework; using Microsoft.Extensions.Logging; +using Umbraco.Core.Configuration; using Umbraco.Core.Migrations; using Umbraco.Core.Migrations.Install; using Umbraco.Core.Migrations.Upgrade; @@ -12,6 +13,7 @@ using Umbraco.Core.Persistence.DatabaseModelDefinitions; using Umbraco.Core.Persistence.Dtos; using Umbraco.Core.Services; using Umbraco.Tests.Common.Builders; +using Umbraco.Tests.Integration.Testing; using Umbraco.Tests.TestHelpers; using Umbraco.Tests.Testing; @@ -19,10 +21,12 @@ namespace Umbraco.Tests.Migrations { [TestFixture] [UmbracoTest(Database = UmbracoTestOptions.Database.NewEmptyPerTest)] - public class AdvancedMigrationTests : TestWithDatabaseBase + public class AdvancedMigrationTests : UmbracoIntegrationTest { private ILoggerFactory _loggerFactory = NullLoggerFactory.Instance; + private IUmbracoVersion UmbracoVersion => GetRequiredService(); + [Test] public void CreateTableOfTDto() { diff --git a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/RelationRepositoryTest.cs b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/RelationRepositoryTest.cs index 56bacb93a9..26efdf325a 100644 --- a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/RelationRepositoryTest.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/RelationRepositoryTest.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using Microsoft.Extensions.Logging; @@ -30,15 +30,21 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor private Content _subpage2; private Relation _relation; private Relation _relation2; + private IContentTypeService ContentTypeService => GetRequiredService(); + private IContentService ContentService => GetRequiredService(); private IMediaTypeService MediaTypeService => GetRequiredService(); + private IMediaService MediaService => GetRequiredService(); private IMemberTypeService MemberTypeService => GetRequiredService(); - private IMemberService MemberService => GetRequiredService(); + + private IMemberService GetMemberService() => GetRequiredService(); + private IRelationService RelationService => GetRequiredService(); + private IFileService FileService => GetRequiredService(); [SetUp] @@ -57,13 +63,12 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor public void Can_Perform_Add_On_RelationRepository() { // Arrange - using (var scope = ScopeProvider.CreateScope()) + using (IScope scope = ScopeProvider.CreateScope()) { - RelationTypeRepository repositoryType; - var repository = CreateRepository(ScopeProvider, out repositoryType); + RelationRepository repository = CreateRepository(ScopeProvider, out RelationTypeRepository repositoryType); // Act - var relationType = repositoryType.Get(1); + IRelationType relationType = repositoryType.Get(1); var relation = new Relation(_textpage.Id, _subpage.Id, relationType); repository.Save(relation); @@ -78,18 +83,17 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor public void Can_Perform_Update_On_RelationRepository() { // Arrange - using (var scope = ScopeProvider.CreateScope()) + using (IScope scope = ScopeProvider.CreateScope()) { - RelationTypeRepository repositoryType; - var repository = CreateRepository(ScopeProvider, out repositoryType); + RelationRepository repository = CreateRepository(ScopeProvider, out RelationTypeRepository repositoryType); // Act - var relation = repository.Get(1); + IRelation relation = repository.Get(1); relation.Comment = "This relation has been updated"; repository.Save(relation); - var relationUpdated = repository.Get(1); + IRelation relationUpdated = repository.Get(1); // Assert Assert.That(relationUpdated, Is.Not.Null); @@ -102,13 +106,12 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor public void Can_Perform_Delete_On_RelationRepository() { // Arrange - using (var scope = ScopeProvider.CreateScope()) + using (IScope scope = ScopeProvider.CreateScope()) { - RelationTypeRepository repositoryType; - var repository = CreateRepository(ScopeProvider, out repositoryType); + RelationRepository repository = CreateRepository(ScopeProvider, out RelationTypeRepository repositoryType); // Act - var relation = repository.Get(2); + IRelation relation = repository.Get(2); repository.Delete(relation); @@ -123,13 +126,12 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor public void Can_Perform_Get_On_RelationRepository() { // Arrange - using (var scope = ScopeProvider.CreateScope()) + using (IScope scope = ScopeProvider.CreateScope()) { - RelationTypeRepository repositoryType; - var repository = CreateRepository(ScopeProvider, out repositoryType); + RelationRepository repository = CreateRepository(ScopeProvider, out RelationTypeRepository repositoryType); // Act - var relation = repository.Get(1); + IRelation relation = repository.Get(1); // Assert Assert.That(relation, Is.Not.Null); @@ -144,13 +146,12 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor public void Can_Perform_GetAll_On_RelationRepository() { // Arrange - using (var scope = ScopeProvider.CreateScope()) + using (IScope scope = ScopeProvider.CreateScope()) { - RelationTypeRepository repositoryType; - var repository = CreateRepository(ScopeProvider, out repositoryType); + RelationRepository repository = CreateRepository(ScopeProvider, out RelationTypeRepository repositoryType); // Act - var relations = repository.GetMany(); + IEnumerable relations = repository.GetMany(); // Assert Assert.That(relations, Is.Not.Null); @@ -164,13 +165,12 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor public void Can_Perform_GetAll_With_Params_On_RelationRepository() { // Arrange - using (var scope = ScopeProvider.CreateScope()) + using (IScope scope = ScopeProvider.CreateScope()) { - RelationTypeRepository repositoryType; - var repository = CreateRepository(ScopeProvider, out repositoryType); + RelationRepository repository = CreateRepository(ScopeProvider, out RelationTypeRepository repositoryType); // Act - var relations = repository.GetMany(1, 2); + IEnumerable relations = repository.GetMany(1, 2); // Assert Assert.That(relations, Is.Not.Null); @@ -183,18 +183,18 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor [Test] public void Get_Paged_Parent_Entities_By_Child_Id() { - CreateTestDataForPagingTests(out var createdContent, out var createdMembers, out var createdMedia); + CreateTestDataForPagingTests(out List createdContent, out List createdMembers, out List createdMedia); - using (var scope = ScopeProvider.CreateScope()) + using (IScope scope = ScopeProvider.CreateScope()) { - var repository = CreateRepository(ScopeProvider, out var relationTypeRepository); + RelationRepository repository = CreateRepository(ScopeProvider, out var relationTypeRepository); // Get parent entities for child id var parents = repository.GetPagedParentEntitiesByChildId(createdMedia[0].Id, 0, 11, out var totalRecords).ToList(); Assert.AreEqual(6, totalRecords); Assert.AreEqual(6, parents.Count); - //add the next page + // add the next page parents.AddRange(repository.GetPagedParentEntitiesByChildId(createdMedia[0].Id, 1, 11, out totalRecords)); Assert.AreEqual(6, totalRecords); Assert.AreEqual(6, parents.Count); @@ -207,7 +207,7 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor Assert.AreEqual(0, mediaEntities.Count); Assert.AreEqual(3, memberEntities.Count); - //only of a certain type + // only of a certain type parents.AddRange(repository.GetPagedParentEntitiesByChildId(createdMedia[0].Id, 0, 100, out totalRecords, UmbracoObjectTypes.Document.GetGuid())); Assert.AreEqual(3, totalRecords); @@ -222,17 +222,17 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor [Test] public void Get_Paged_Parent_Child_Entities_With_Same_Entity_Relation() { - //Create a media item and create a relationship between itself (parent -> child) - var imageType = MediaTypeBuilder.CreateImageMediaType("myImage"); + // Create a media item and create a relationship between itself (parent -> child) + MediaType imageType = MediaTypeBuilder.CreateImageMediaType("myImage"); MediaTypeService.Save(imageType); - var media = MediaBuilder.CreateMediaImage(imageType, -1); + Media media = MediaBuilder.CreateMediaImage(imageType, -1); MediaService.Save(media); - var relType = RelationService.GetRelationTypeByAlias(Constants.Conventions.RelationTypes.RelatedMediaAlias); + IRelationType relType = RelationService.GetRelationTypeByAlias(Constants.Conventions.RelationTypes.RelatedMediaAlias); RelationService.Relate(media.Id, media.Id, relType); - using (var scope = ScopeProvider.CreateScope()) + using (IScope scope = ScopeProvider.CreateScope()) { - var repository = CreateRepository(ScopeProvider, out var relationTypeRepository); + RelationRepository repository = CreateRepository(ScopeProvider, out var relationTypeRepository); // Get parent entities for child id var parents = repository.GetPagedParentEntitiesByChildId(media.Id, 0, 10, out var totalRecords).ToList(); @@ -251,16 +251,16 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor { CreateTestDataForPagingTests(out var createdContent, out var createdMembers, out _); - using (var scope = ScopeProvider.CreateScope()) + using (IScope scope = ScopeProvider.CreateScope()) { - var repository = CreateRepository(ScopeProvider, out _); + RelationRepository repository = CreateRepository(ScopeProvider, out _); // Get parent entities for child id var parents = repository.GetPagedChildEntitiesByParentId(createdContent[0].Id, 0, 6, out var totalRecords).ToList(); Assert.AreEqual(3, totalRecords); Assert.AreEqual(3, parents.Count); - //add the next page + // add the next page parents.AddRange(repository.GetPagedChildEntitiesByParentId(createdContent[0].Id, 1, 6, out totalRecords)); Assert.AreEqual(3, totalRecords); Assert.AreEqual(3, parents.Count); @@ -273,7 +273,7 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor Assert.AreEqual(3, mediaEntities.Count); Assert.AreEqual(0, memberEntities.Count); - //only of a certain type + // only of a certain type parents.AddRange(repository.GetPagedChildEntitiesByParentId(createdContent[0].Id, 0, 100, out totalRecords, UmbracoObjectTypes.Media.GetGuid())); Assert.AreEqual(3, totalRecords); @@ -287,9 +287,9 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor private void CreateTestDataForPagingTests(out List createdContent, out List createdMembers, out List createdMedia) { - //Create content + // Create content createdContent = new List(); - var contentType = ContentTypeBuilder.CreateBasicContentType("blah"); + ContentType contentType = ContentTypeBuilder.CreateBasicContentType("blah"); ContentTypeService.Save(contentType); for (int i = 0; i < 3; i++) { @@ -298,33 +298,42 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor createdContent.Add(c1); } - //Create media + // Create media createdMedia = new List(); - var imageType = MediaTypeBuilder.CreateImageMediaType("myImage"); + MediaType imageType = MediaTypeBuilder.CreateImageMediaType("myImage"); MediaTypeService.Save(imageType); for (int i = 0; i < 3; i++) { - var c1 = MediaBuilder.CreateMediaImage(imageType, -1); + Media c1 = MediaBuilder.CreateMediaImage(imageType, -1); MediaService.Save(c1); createdMedia.Add(c1); } // Create members - var memberType = MemberTypeBuilder.CreateSimpleMemberType("simple"); + MemberType memberType = MemberTypeBuilder.CreateSimpleMemberType("simple"); MemberTypeService.Save(memberType); createdMembers = MemberBuilder.CreateSimpleMembers(memberType, 3).ToList(); - MemberService.Save(createdMembers); + GetMemberService().Save(createdMembers); - var relType = RelationService.GetRelationTypeByAlias(Constants.Conventions.RelationTypes.RelatedMediaAlias); + IRelationType relType = RelationService.GetRelationTypeByAlias(Constants.Conventions.RelationTypes.RelatedMediaAlias); // Relate content to media - foreach (var content in createdContent) - foreach (var media in createdMedia) + foreach (IContent content in createdContent) + { + foreach (IMedia media in createdMedia) + { RelationService.Relate(content.Id, media.Id, relType); + } + } + // Relate members to media - foreach (var member in createdMembers) - foreach (var media in createdMedia) + foreach (IMember member in createdMembers) + { + foreach (IMedia media in createdMedia) + { RelationService.Relate(member.Id, media.Id, relType); + } + } } [Test] @@ -333,8 +342,7 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor // Arrange using (var scope = ScopeProvider.CreateScope()) { - RelationTypeRepository repositoryType; - var repository = CreateRepository(ScopeProvider, out repositoryType); + var repository = CreateRepository(ScopeProvider, out RelationTypeRepository repositoryType); // Act var exists = repository.Exists(2); @@ -352,8 +360,7 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor // Arrange using (var scope = ScopeProvider.CreateScope()) { - RelationTypeRepository repositoryType; - var repository = CreateRepository(ScopeProvider, out repositoryType); + var repository = CreateRepository(ScopeProvider, out RelationTypeRepository repositoryType); // Act var query = scope.SqlContext.Query().Where(x => x.ParentId == _textpage.Id); @@ -368,14 +375,13 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor public void Can_Perform_GetByQuery_On_RelationRepository() { // Arrange - using (var scope = ScopeProvider.CreateScope()) + using (IScope scope = ScopeProvider.CreateScope()) { - RelationTypeRepository repositoryType; - var repository = CreateRepository(ScopeProvider, out repositoryType); + RelationRepository repository = CreateRepository(ScopeProvider, out RelationTypeRepository repositoryType); // Act - var query = scope.SqlContext.Query().Where(x => x.RelationTypeId == _relateContent.Id); - var relations = repository.Get(query); + global::Umbraco.Core.Persistence.Querying.IQuery query = scope.SqlContext.Query().Where(x => x.RelationTypeId == _relateContent.Id); + IEnumerable relations = repository.Get(query); // Assert Assert.That(relations, Is.Not.Null); @@ -389,12 +395,11 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor public void Can_Delete_Content_And_Verify_Relation_Is_Removed() { // Arrange - using (var scope = ScopeProvider.CreateScope()) + using (IScope scope = ScopeProvider.CreateScope()) { - RelationTypeRepository repositoryType; - var repository = CreateRepository(ScopeProvider, out repositoryType); + RelationRepository repository = CreateRepository(ScopeProvider, out RelationTypeRepository repositoryType); - var content = ContentService.GetById(_subpage.Id); + IContent content = ContentService.GetById(_subpage.Id); ContentService.Delete(content, 0); // Act @@ -410,17 +415,20 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor public void CreateTestData() { _relateContent = new RelationType( - "Relate Content on Copy", "relateContentOnCopy", true, + "Relate Content on Copy", + "relateContentOnCopy", + true, Constants.ObjectTypes.Document, new Guid("C66BA18E-EAF3-4CFF-8A22-41B16D66A972")); - _relateContentType = new RelationType("Relate ContentType on Copy", + _relateContentType = new RelationType( + "Relate ContentType on Copy", "relateContentTypeOnCopy", true, Constants.ObjectTypes.DocumentType, new Guid("A2CB7800-F571-4787-9638-BC48539A0EFB")); - using (var scope = ScopeProvider.CreateScope()) + using (IScope scope = ScopeProvider.CreateScope()) { var accessor = (IScopeAccessor)ScopeProvider; var relationTypeRepository = new RelationTypeRepository(accessor, AppCaches.Disabled, Mock.Of>()); @@ -430,22 +438,22 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Persistence.Repositor relationTypeRepository.Save(_relateContent); relationTypeRepository.Save(_relateContentType); - var template = TemplateBuilder.CreateTextPageTemplate(); + Template template = TemplateBuilder.CreateTextPageTemplate(); FileService.SaveTemplate(template); - //Create and Save ContentType "umbTextpage" -> (NodeDto.NodeIdSeed) + // Create and Save ContentType "umbTextpage" -> (NodeDto.NodeIdSeed) _contentType = ContentTypeBuilder.CreateSimpleContentType("umbTextpage", "Textpage", defaultTemplateId: template.Id); ContentTypeService.Save(_contentType); - //Create and Save Content "Homepage" based on "umbTextpage" -> (NodeDto.NodeIdSeed + 1) + // Create and Save Content "Homepage" based on "umbTextpage" -> (NodeDto.NodeIdSeed + 1) _textpage = ContentBuilder.CreateSimpleContent(_contentType); ContentService.Save(_textpage, 0); - //Create and Save Content "Text Page 1" based on "umbTextpage" -> (NodeDto.NodeIdSeed + 2) + // Create and Save Content "Text Page 1" based on "umbTextpage" -> (NodeDto.NodeIdSeed + 2) _subpage = ContentBuilder.CreateSimpleContent(_contentType, "Text Page 1", _textpage.Id); ContentService.Save(_subpage, 0); - //Create and Save Content "Text Page 1" based on "umbTextpage" -> (NodeDto.NodeIdSeed + 3) + // Create and Save Content "Text Page 1" based on "umbTextpage" -> (NodeDto.NodeIdSeed + 3) _subpage2 = ContentBuilder.CreateSimpleContent(_contentType, "Text Page 2", _textpage.Id); ContentService.Save(_subpage2, 0); diff --git a/src/Umbraco.Tests/Services/RedirectUrlServiceTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/RedirectUrlServiceTests.cs similarity index 55% rename from src/Umbraco.Tests/Services/RedirectUrlServiceTests.cs rename to src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/RedirectUrlServiceTests.cs index 8f38bd67eb..89cde051e3 100644 --- a/src/Umbraco.Tests/Services/RedirectUrlServiceTests.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/RedirectUrlServiceTests.cs @@ -1,81 +1,72 @@ -using System; -using System.Linq; +using System.Linq; using System.Threading; using Microsoft.Extensions.Logging; using Moq; using NUnit.Framework; using Umbraco.Core.Cache; -using Umbraco.Core.Logging; using Umbraco.Core.Models; - -using Umbraco.Core.Persistence.Repositories; using Umbraco.Core.Persistence.Repositories.Implement; using Umbraco.Core.Scoping; +using Umbraco.Core.Services; +using Umbraco.Tests.Integration.Testing; using Umbraco.Tests.Testing; -namespace Umbraco.Tests.Services +namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Services { [TestFixture] [Apartment(ApartmentState.STA)] [UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerTest)] - public class RedirectUrlServiceTests : TestWithSomeContentBase + public class RedirectUrlServiceTests : UmbracoIntegrationTestWithContent { private IContent _testPage; private IContent _altTestPage; - private string _url = "blah"; - private string _cultureA = "en"; - private string _cultureB = "de"; + private const string Url = "blah"; + private const string CultureA = "en"; + private const string CultureB = "de"; + + private IRedirectUrlService RedirectUrlService => GetRequiredService(); + public override void CreateTestData() { base.CreateTestData(); - using (var scope = ScopeProvider.CreateScope()) + using (IScope scope = ScopeProvider.CreateScope()) { var repository = new RedirectUrlRepository((IScopeAccessor)ScopeProvider, AppCaches.Disabled, Mock.Of>()); - var rootContent = ServiceContext.ContentService.GetRootContent().FirstOrDefault(); - var subPages = ServiceContext.ContentService.GetPagedChildren(rootContent.Id, 0, 2, out _).ToList(); + IContent rootContent = ContentService.GetRootContent().First(); + var subPages = ContentService.GetPagedChildren(rootContent.Id, 0, 2, out _).ToList(); _testPage = subPages[0]; _altTestPage = subPages[1]; repository.Save(new RedirectUrl { ContentKey = _testPage.Key, - Url = _url, - Culture = _cultureA + Url = Url, + Culture = CultureA }); repository.Save(new RedirectUrl { ContentKey = _altTestPage.Key, - Url = _url, - Culture = _cultureB + Url = Url, + Culture = CultureB }); scope.Complete(); } } - [TearDown] - public override void TearDown() - { - base.TearDown(); - } [Test] public void Can_Get_Most_Recent_RedirectUrl() { - var redirectUrlService = ServiceContext.RedirectUrlService; - var redirect = redirectUrlService.GetMostRecentRedirectUrl(_url); + IRedirectUrl redirect = RedirectUrlService.GetMostRecentRedirectUrl(Url); Assert.AreEqual(redirect.ContentId, _altTestPage.Id); - } [Test] public void Can_Get_Most_Recent_RedirectUrl_With_Culture() { - var redirectUrlService = ServiceContext.RedirectUrlService; - var redirect = redirectUrlService.GetMostRecentRedirectUrl(_url, _cultureA); + IRedirectUrl redirect = RedirectUrlService.GetMostRecentRedirectUrl(Url, CultureA); Assert.AreEqual(redirect.ContentId, _testPage.Id); - } - } } diff --git a/src/Umbraco.Tests.UnitTests/TestHelpers/Objects/TestUmbracoContextFactory.cs b/src/Umbraco.Tests.UnitTests/TestHelpers/Objects/TestUmbracoContextFactory.cs index 6853a02314..7889d49192 100644 --- a/src/Umbraco.Tests.UnitTests/TestHelpers/Objects/TestUmbracoContextFactory.cs +++ b/src/Umbraco.Tests.UnitTests/TestHelpers/Objects/TestUmbracoContextFactory.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Options; using Moq; using Umbraco.Core.Configuration.Models; @@ -48,10 +48,8 @@ namespace Umbraco.Tests.UnitTests.TestHelpers.Objects new TestVariationContextAccessor(), new TestDefaultCultureAccessor(), Options.Create(globalSettings), - Mock.Of(), hostingEnvironment, new UriUtility(hostingEnvironment), - httpContextAccessor, new AspNetCoreCookieManager(httpContextAccessor), Mock.Of(), backofficeSecurityAccessorMock.Object diff --git a/src/Umbraco.Tests/Cache/DefaultCachePolicyTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Cache/DefaultCachePolicyTests.cs similarity index 91% rename from src/Umbraco.Tests/Cache/DefaultCachePolicyTests.cs rename to src/Umbraco.Tests.UnitTests/Umbraco.Core/Cache/DefaultCachePolicyTests.cs index 74aba2b824..a8592356e9 100644 --- a/src/Umbraco.Tests/Cache/DefaultCachePolicyTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Cache/DefaultCachePolicyTests.cs @@ -1,13 +1,12 @@ using System; using System.Collections.Generic; -using System.Web.Caching; using Moq; using NUnit.Framework; using Umbraco.Core.Cache; using Umbraco.Core.Models; using Umbraco.Core.Scoping; -namespace Umbraco.Tests.Cache +namespace Umbraco.Tests.UnitTests.Umbraco.Core.Cache { [TestFixture] public class DefaultCachePolicyTests @@ -37,7 +36,7 @@ namespace Umbraco.Tests.Cache var defaultPolicy = new DefaultRepositoryCachePolicy(cache.Object, DefaultAccessor, new RepositoryCachePolicyOptions()); - var unused = defaultPolicy.Get(1, id => new AuditItem(1, AuditType.Copy, 123, "test", "blah"), o => null); + AuditItem unused = defaultPolicy.Get(1, id => new AuditItem(1, AuditType.Copy, 123, "test", "blah"), o => null); Assert.IsTrue(isCached); } @@ -49,7 +48,7 @@ namespace Umbraco.Tests.Cache var defaultPolicy = new DefaultRepositoryCachePolicy(cache.Object, DefaultAccessor, new RepositoryCachePolicyOptions()); - var found = defaultPolicy.Get(1, id => null, ids => null); + AuditItem found = defaultPolicy.Get(1, id => null, ids => null); Assert.IsNotNull(found); } @@ -67,7 +66,7 @@ namespace Umbraco.Tests.Cache var defaultPolicy = new DefaultRepositoryCachePolicy(cache.Object, DefaultAccessor, new RepositoryCachePolicyOptions()); - var unused = defaultPolicy.GetAll(new object[] {}, ids => new[] + AuditItem[] unused = defaultPolicy.GetAll(new object[] {}, ids => new[] { new AuditItem(1, AuditType.Copy, 123, "test", "blah"), new AuditItem(2, AuditType.Copy, 123, "test", "blah2") @@ -88,7 +87,7 @@ namespace Umbraco.Tests.Cache var defaultPolicy = new DefaultRepositoryCachePolicy(cache.Object, DefaultAccessor, new RepositoryCachePolicyOptions()); - var found = defaultPolicy.GetAll(new object[] {}, ids => new[] { (AuditItem)null }); + AuditItem[] found = defaultPolicy.GetAll(new object[] {}, ids => new[] { (AuditItem)null }); Assert.AreEqual(2, found.Length); } diff --git a/src/Umbraco.Tests/Cache/FullDataSetCachePolicyTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Cache/FullDataSetCachePolicyTests.cs similarity index 99% rename from src/Umbraco.Tests/Cache/FullDataSetCachePolicyTests.cs rename to src/Umbraco.Tests.UnitTests/Umbraco.Core/Cache/FullDataSetCachePolicyTests.cs index 027f6d2d69..e904f9104e 100644 --- a/src/Umbraco.Tests/Cache/FullDataSetCachePolicyTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Cache/FullDataSetCachePolicyTests.cs @@ -2,7 +2,6 @@ using System.Collections; using System.Collections.Generic; using System.Linq; -using System.Web.Caching; using Moq; using NUnit.Framework; using Umbraco.Core.Cache; @@ -10,7 +9,7 @@ using Umbraco.Core.Collections; using Umbraco.Core.Models; using Umbraco.Core.Scoping; -namespace Umbraco.Tests.Cache +namespace Umbraco.Tests.UnitTests.Umbraco.Core.Cache { [TestFixture] public class FullDataSetCachePolicyTests diff --git a/src/Umbraco.Tests/Cache/RefresherTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Cache/RefresherTests.cs similarity index 98% rename from src/Umbraco.Tests/Cache/RefresherTests.cs rename to src/Umbraco.Tests.UnitTests/Umbraco.Core/Cache/RefresherTests.cs index eb8580c9e2..59d2f010d2 100644 --- a/src/Umbraco.Tests/Cache/RefresherTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Cache/RefresherTests.cs @@ -4,7 +4,7 @@ using NUnit.Framework; using Umbraco.Core.Services.Changes; using Umbraco.Web.Cache; -namespace Umbraco.Tests.Cache +namespace Umbraco.Tests.UnitTests.Umbraco.Core.Cache { [TestFixture] public class RefreshersTests diff --git a/src/Umbraco.Tests/Cache/SingleItemsOnlyCachePolicyTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Cache/SingleItemsOnlyCachePolicyTests.cs similarity index 97% rename from src/Umbraco.Tests/Cache/SingleItemsOnlyCachePolicyTests.cs rename to src/Umbraco.Tests.UnitTests/Umbraco.Core/Cache/SingleItemsOnlyCachePolicyTests.cs index 335335e391..323b83699c 100644 --- a/src/Umbraco.Tests/Cache/SingleItemsOnlyCachePolicyTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Cache/SingleItemsOnlyCachePolicyTests.cs @@ -1,13 +1,12 @@ using System; using System.Collections.Generic; -using System.Web.Caching; using Moq; using NUnit.Framework; using Umbraco.Core.Cache; using Umbraco.Core.Models; using Umbraco.Core.Scoping; -namespace Umbraco.Tests.Cache +namespace Umbraco.Tests.UnitTests.Umbraco.Core.Cache { [TestFixture] public class SingleItemsOnlyCachePolicyTests diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Components/ComponentTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Components/ComponentTests.cs index 44aacab944..6d51603502 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Components/ComponentTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Components/ComponentTests.cs @@ -68,7 +68,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Components private static TypeLoader MockTypeLoader() { var ioHelper = IOHelper; - return new TypeLoader(Mock.Of(), Mock.Of(), new DirectoryInfo(TestHelper.GetHostingEnvironment().MapPathContentRoot("~/App_Data/TEMP")), Mock.Of>(), Mock.Of()); + return new TypeLoader(Mock.Of(), Mock.Of(), new DirectoryInfo(TestHelper.GetHostingEnvironment().MapPathContentRoot(Constants.SystemDirectories.TempData)), Mock.Of>(), Mock.Of()); } @@ -390,7 +390,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Components public void AllComposers() { var typeFinder = TestHelper.GetTypeFinder(); - var typeLoader = new TypeLoader(typeFinder, AppCaches.Disabled.RuntimeCache, new DirectoryInfo(TestHelper.GetHostingEnvironment().MapPathContentRoot("~/App_Data/TEMP")), Mock.Of>(), Mock.Of()); + var typeLoader = new TypeLoader(typeFinder, AppCaches.Disabled.RuntimeCache, new DirectoryInfo(TestHelper.GetHostingEnvironment().MapPathContentRoot(Constants.SystemDirectories.TempData)), Mock.Of>(), Mock.Of()); var register = MockRegister(); var builder = new UmbracoBuilder(register, Mock.Of(), TestHelper.GetMockedTypeLoader()); diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/ComposingTestBase.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/ComposingTestBase.cs index 43760d1c6c..1c8bf139ac 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/ComposingTestBase.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/ComposingTestBase.cs @@ -1,9 +1,10 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; using System.Reflection; using Microsoft.Extensions.Logging; using Moq; using NUnit.Framework; +using Umbraco.Core; using Umbraco.Core.Cache; using Umbraco.Core.Composing; using Umbraco.Core.Logging; @@ -23,7 +24,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Composing ProfilingLogger = new ProfilingLogger(Mock.Of>(), Mock.Of()); var typeFinder = TestHelper.GetTypeFinder(); - TypeLoader = new TypeLoader(typeFinder, NoAppCache.Instance, new DirectoryInfo(TestHelper.GetHostingEnvironment().MapPathContentRoot("~/App_Data/TEMP")), Mock.Of>(), ProfilingLogger, false, AssembliesToScan); + TypeLoader = new TypeLoader(typeFinder, NoAppCache.Instance, new DirectoryInfo(TestHelper.GetHostingEnvironment().MapPathContentRoot(Constants.SystemDirectories.TempData)), Mock.Of>(), ProfilingLogger, false, AssembliesToScan); } protected virtual IEnumerable AssembliesToScan diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/TypeLoaderTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/TypeLoaderTests.cs index 20e9f8feef..36843ad1cc 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/TypeLoaderTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Composing/TypeLoaderTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -28,7 +28,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Core.Composing // this ensures it's reset var typeFinder = TestHelper.GetTypeFinder(); _typeLoader = new TypeLoader(typeFinder, NoAppCache.Instance, - new DirectoryInfo(TestHelper.GetHostingEnvironment().MapPathContentRoot("~/App_Data/TEMP")), + new DirectoryInfo(TestHelper.GetHostingEnvironment().MapPathContentRoot(Constants.SystemDirectories.TempData)), Mock.Of>(), new ProfilingLogger(Mock.Of>(), Mock.Of()), false, // for testing, we'll specify which assemblies are scanned for the PluginTypeResolver diff --git a/src/Umbraco.Tests/Published/ConvertersTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/ConvertersTests.cs similarity index 63% rename from src/Umbraco.Tests/Published/ConvertersTests.cs rename to src/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/ConvertersTests.cs index 8a9bdb99ca..f41a950c27 100644 --- a/src/Umbraco.Tests/Published/ConvertersTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/ConvertersTests.cs @@ -14,9 +14,9 @@ using Umbraco.Core.PropertyEditors; using Umbraco.Core.Serialization; using Umbraco.Core.Services; using Umbraco.Core.Strings; -using Umbraco.Tests.PublishedContent; +using Umbraco.Tests.Common.PublishedContent; using Umbraco.Tests.TestHelpers; -using Umbraco.Web; +using Umbraco.Tests.UnitTests.TestHelpers; using Umbraco.Web.PublishedCache; namespace Umbraco.Tests.Published @@ -24,13 +24,10 @@ namespace Umbraco.Tests.Published [TestFixture] public class ConvertersTests { - #region SimpleConverter3 - [Test] public void SimpleConverter3Test() { - // Current.Reset(); - var register = TestHelper.GetRegister(); + var register = new ServiceCollection(); var composition = new UmbracoBuilder(register, Mock.Of(), TestHelper.GetMockedTypeLoader()); @@ -38,37 +35,41 @@ namespace Umbraco.Tests.Published .Append() .Append(); - IPublishedModelFactory factory = new PublishedModelFactory(new[] - { - typeof (PublishedSnapshotTestObjects.TestElementModel1), typeof (PublishedSnapshotTestObjects.TestElementModel2), - typeof (PublishedSnapshotTestObjects.TestContentModel1), typeof (PublishedSnapshotTestObjects.TestContentModel2), - }, Mock.Of()); + IPublishedModelFactory factory = new PublishedModelFactory( + new[] + { + typeof(PublishedSnapshotTestObjects.TestElementModel1), + typeof(PublishedSnapshotTestObjects.TestElementModel2), + typeof(PublishedSnapshotTestObjects.TestContentModel1), + typeof(PublishedSnapshotTestObjects.TestContentModel2) + }, Mock.Of()); register.AddTransient(f => factory); - var cacheMock = new Mock(); var cacheContent = new Dictionary(); - cacheMock.Setup(x => x.GetById(It.IsAny())).Returns(id => cacheContent.TryGetValue(id, out IPublishedContent content) ? content : null); + cacheMock.Setup(x => x.GetById(It.IsAny())).Returns(id => + cacheContent.TryGetValue(id, out IPublishedContent content) ? content : null); var publishedSnapshotMock = new Mock(); publishedSnapshotMock.Setup(x => x.Content).Returns(cacheMock.Object); var publishedSnapshotAccessorMock = new Mock(); publishedSnapshotAccessorMock.Setup(x => x.PublishedSnapshot).Returns(publishedSnapshotMock.Object); register.AddTransient(f => publishedSnapshotAccessorMock.Object); - var registerFactory = composition.CreateServiceProvider(); - var converters = registerFactory.GetRequiredService(); + IServiceProvider registerFactory = composition.CreateServiceProvider(); + PropertyValueConverterCollection converters = + registerFactory.GetRequiredService(); var serializer = new ConfigurationEditorJsonSerializer(); var dataTypeServiceMock = new Mock(); var dataType1 = new DataType(new VoidEditor(NullLoggerFactory.Instance, dataTypeServiceMock.Object, - Mock.Of(), Mock.Of(), Mock.Of(), new JsonNetSerializer()), serializer) - { Id = 1 }; + Mock.Of(), Mock.Of(), Mock.Of(), new JsonNetSerializer()), + serializer) { Id = 1 }; var dataType2 = new DataType(new VoidEditor("2", NullLoggerFactory.Instance, Mock.Of(), - Mock.Of(), Mock.Of(), Mock.Of(), new JsonNetSerializer()), serializer) - { Id = 2 }; + Mock.Of(), Mock.Of(), Mock.Of(), new JsonNetSerializer()), + serializer) { Id = 2 }; - dataTypeServiceMock.Setup(x => x.GetAll()).Returns(new []{dataType1, dataType2 }); + dataTypeServiceMock.Setup(x => x.GetAll()).Returns(new[] { dataType1, dataType2 }); var contentTypeFactory = new PublishedContentTypeFactory(factory, converters, dataTypeServiceMock.Object); @@ -77,52 +78,69 @@ namespace Umbraco.Tests.Published yield return contentTypeFactory.CreatePropertyType(contentType, "prop" + i, i); } - var elementType1 = contentTypeFactory.CreateContentType(Guid.NewGuid(), 1000, "element1", t => CreatePropertyTypes(t, 1)); - var elementType2 = contentTypeFactory.CreateContentType(Guid.NewGuid(), 1001, "element2", t => CreatePropertyTypes(t, 2)); - var contentType1 = contentTypeFactory.CreateContentType(Guid.NewGuid(), 1002, "content1", t => CreatePropertyTypes(t, 1)); - var contentType2 = contentTypeFactory.CreateContentType(Guid.NewGuid(), 1003, "content2", t => CreatePropertyTypes(t, 2)); + IPublishedContentType elementType1 = + contentTypeFactory.CreateContentType(Guid.NewGuid(), 1000, "element1", t => CreatePropertyTypes(t, 1)); + IPublishedContentType elementType2 = + contentTypeFactory.CreateContentType(Guid.NewGuid(), 1001, "element2", t => CreatePropertyTypes(t, 2)); + IPublishedContentType contentType1 = + contentTypeFactory.CreateContentType(Guid.NewGuid(), 1002, "content1", t => CreatePropertyTypes(t, 1)); + IPublishedContentType contentType2 = + contentTypeFactory.CreateContentType(Guid.NewGuid(), 1003, "content2", t => CreatePropertyTypes(t, 2)); - var element1 = new PublishedElement(elementType1, Guid.NewGuid(), new Dictionary { { "prop1", "val1" } }, false); - var element2 = new PublishedElement(elementType2, Guid.NewGuid(), new Dictionary { { "prop2", "1003" } }, false); + var element1 = new PublishedElement(elementType1, Guid.NewGuid(), + new Dictionary { { "prop1", "val1" } }, false); + var element2 = new PublishedElement(elementType2, Guid.NewGuid(), + new Dictionary { { "prop2", "1003" } }, false); var cnt1 = new SolidPublishedContent(contentType1) { Id = 1003, - Properties = new[] { new SolidPublishedProperty { Alias = "prop1", SolidHasValue = true, SolidValue = "val1" } } + Properties = new[] + { + new SolidPublishedProperty { Alias = "prop1", SolidHasValue = true, SolidValue = "val1" } + } }; var cnt2 = new SolidPublishedContent(contentType1) { Id = 1004, - Properties = new[] { new SolidPublishedProperty { Alias = "prop2", SolidHasValue = true, SolidValue = "1003" } } + Properties = new[] + { + new SolidPublishedProperty { Alias = "prop2", SolidHasValue = true, SolidValue = "1003" } + } }; - var publishedModelFactory = registerFactory.GetRequiredService(); + IPublishedModelFactory publishedModelFactory = registerFactory.GetRequiredService(); cacheContent[cnt1.Id] = cnt1.CreateModel(publishedModelFactory); cacheContent[cnt2.Id] = cnt2.CreateModel(publishedModelFactory); // can get the actual property Clr type // ie ModelType gets properly mapped by IPublishedContentModelFactory // must test ModelClrType with special equals 'cos they are not ref-equals - Assert.IsTrue(ModelType.Equals(typeof(IEnumerable<>).MakeGenericType(ModelType.For("content1")), contentType2.GetPropertyType("prop2").ModelClrType)); - Assert.AreEqual(typeof(IEnumerable), contentType2.GetPropertyType("prop2").ClrType); + Assert.IsTrue(ModelType.Equals(typeof(IEnumerable<>).MakeGenericType(ModelType.For("content1")), + contentType2.GetPropertyType("prop2").ModelClrType)); + Assert.AreEqual(typeof(IEnumerable), + contentType2.GetPropertyType("prop2").ClrType); // can create a model for an element - var model1 = factory.CreateModel(element1); + IPublishedElement model1 = factory.CreateModel(element1); Assert.IsInstanceOf(model1); Assert.AreEqual("val1", ((PublishedSnapshotTestObjects.TestElementModel1)model1).Prop1); // can create a model for a published content - var model2 = factory.CreateModel(element2); + IPublishedElement model2 = factory.CreateModel(element2); Assert.IsInstanceOf(model2); var mmodel2 = (PublishedSnapshotTestObjects.TestElementModel2)model2; // and get direct property - Assert.IsInstanceOf(model2.Value(Mock.Of(), "prop2")); - Assert.AreEqual(1, ((PublishedSnapshotTestObjects.TestContentModel1[])model2.Value(Mock.Of(), "prop2")).Length); + Assert.IsInstanceOf( + model2.Value(Mock.Of(), "prop2")); + Assert.AreEqual(1, + ((PublishedSnapshotTestObjects.TestContentModel1[])model2.Value(Mock.Of(), + "prop2")).Length); // and get model property Assert.IsInstanceOf>(mmodel2.Prop2); Assert.IsInstanceOf(mmodel2.Prop2); - var mmodel1 = mmodel2.Prop2.First(); + PublishedSnapshotTestObjects.TestContentModel1 mmodel1 = mmodel2.Prop2.First(); // and we get what we want Assert.AreSame(cacheContent[mmodel1.Id], mmodel1); @@ -144,10 +162,8 @@ namespace Umbraco.Tests.Published { private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor; - public SimpleConverter3B(IPublishedSnapshotAccessor publishedSnapshotAccessor) - { + public SimpleConverter3B(IPublishedSnapshotAccessor publishedSnapshotAccessor) => _publishedSnapshotAccessor = publishedSnapshotAccessor; - } public override bool IsConverter(IPublishedPropertyType propertyType) => propertyType.EditorAlias == "Umbraco.Void.2"; @@ -158,18 +174,18 @@ namespace Umbraco.Tests.Published public override PropertyCacheLevel GetPropertyCacheLevel(IPublishedPropertyType propertyType) => PropertyCacheLevel.Elements; - public override object ConvertSourceToIntermediate(IPublishedElement owner, IPublishedPropertyType propertyType, object source, bool preview) + public override object ConvertSourceToIntermediate(IPublishedElement owner, + IPublishedPropertyType propertyType, object source, bool preview) { var s = source as string; return s?.Split(',').Select(int.Parse).ToArray() ?? Array.Empty(); } - public override object ConvertIntermediateToObject(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object inter, bool preview) - { - return ((int[])inter).Select(x => (PublishedSnapshotTestObjects.TestContentModel1)_publishedSnapshotAccessor.PublishedSnapshot.Content.GetById(x)).ToArray(); - } + public override object ConvertIntermediateToObject(IPublishedElement owner, + IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object inter, + bool preview) => ((int[])inter).Select(x => + (PublishedSnapshotTestObjects.TestContentModel1)_publishedSnapshotAccessor.PublishedSnapshot.Content + .GetById(x)).ToArray(); } - - #endregion } } diff --git a/src/Umbraco.Tests/Migrations/AlterMigrationTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/AlterMigrationTests.cs similarity index 61% rename from src/Umbraco.Tests/Migrations/AlterMigrationTests.cs rename to src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/AlterMigrationTests.cs index 2d8dd7d18e..23ee3e143a 100644 --- a/src/Umbraco.Tests/Migrations/AlterMigrationTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/AlterMigrationTests.cs @@ -1,39 +1,20 @@ using System; using System.Diagnostics; -using System.Data.Common; using System.Linq; using Microsoft.Extensions.Logging; using Moq; -using NPoco; using NUnit.Framework; -using Umbraco.Core; using Umbraco.Core.Migrations; -using Umbraco.Core.Persistence; -using Umbraco.Core.Persistence.SqlSyntax; -using Umbraco.Persistance.SqlCe; using Umbraco.Tests.Migrations.Stubs; -using Umbraco.Tests.TestHelpers; using Umbraco.Tests.Testing; -namespace Umbraco.Tests.Migrations +namespace Umbraco.Tests.UnitTests.Umbraco.Infrastructure.Migrations { [TestFixture] public class AlterMigrationTests { - private ILogger _logger; - private ISqlSyntaxProvider _sqlSyntax; - private IUmbracoDatabase _database; + private readonly ILogger _logger = Mock.Of>(); - [SetUp] - public void Setup() - { - _logger = Mock.Of>(); - _sqlSyntax = new SqlCeSyntaxProvider(); - - var dbProviderFactory = DbProviderFactories.GetFactory(Constants.DbProviderNames.SqlServer); - var sqlContext = new SqlContext(_sqlSyntax, DatabaseType.SqlServer2008, Mock.Of()); - _database = new UmbracoDatabase("cstr", sqlContext, dbProviderFactory, Mock.Of>(), TestHelper.BulkSqlInsertProvider); - } [Test] public void Drop_Foreign_Key() @@ -46,13 +27,15 @@ namespace Umbraco.Tests.Migrations // Act stub.Migrate(); - foreach (var op in database.Operations) + foreach (TestDatabase.Operation op in database.Operations) + { Console.WriteLine("{0}\r\n\t{1}", op.Text, op.Sql); + } // Assert Assert.That(database.Operations.Count, Is.EqualTo(1)); - Assert.That(database.Operations[0].Sql, Is.EqualTo("ALTER TABLE [umbracoUser2app] DROP CONSTRAINT [FK_umbracoUser2app_umbracoUser_id]")); - + Assert.That(database.Operations[0].Sql, + Is.EqualTo("ALTER TABLE [umbracoUser2app] DROP CONSTRAINT [FK_umbracoUser2app_umbracoUser_id]")); } [Test] @@ -64,23 +47,24 @@ namespace Umbraco.Tests.Migrations migration.Migrate(); - foreach (var op in database.Operations) + foreach (TestDatabase.Operation op in database.Operations) + { Console.WriteLine("{0}\r\n\t{1}", op.Text, op.Sql); + } Assert.That(database.Operations.Count, Is.EqualTo(1)); - Assert.That(database.Operations[0].Sql, Is.EqualTo("ALTER TABLE [bar] ADD [foo] UniqueIdentifier NOT NULL")); + Assert.That(database.Operations[0].Sql, + Is.EqualTo("ALTER TABLE [bar] ADD [foo] UniqueIdentifier NOT NULL")); } public class CreateColumnMigration : MigrationBase { public CreateColumnMigration(IMigrationContext context) : base(context) - { } - - public override void Migrate() { - Alter.Table("bar").AddColumn("foo").AsGuid().Do(); } + + public override void Migrate() => Alter.Table("bar").AddColumn("foo").AsGuid().Do(); } [Test] @@ -92,28 +76,30 @@ namespace Umbraco.Tests.Migrations migration.Migrate(); - foreach (var op in database.Operations) + foreach (TestDatabase.Operation op in database.Operations) + { Console.WriteLine("{0}\r\n\t{1}", op.Text, op.Sql); + } Assert.That(database.Operations.Count, Is.EqualTo(1)); - Assert.That(database.Operations[0].Sql, Is.EqualTo("ALTER TABLE [bar] ALTER COLUMN [foo] UniqueIdentifier NOT NULL")); + Assert.That(database.Operations[0].Sql, + Is.EqualTo("ALTER TABLE [bar] ALTER COLUMN [foo] UniqueIdentifier NOT NULL")); } public class AlterColumnMigration : MigrationBase { public AlterColumnMigration(IMigrationContext context) : base(context) - { } - - public override void Migrate() { + } + + public override void Migrate() => // bad/good syntax... //Alter.Column("foo").OnTable("bar").AsGuid().NotNullable(); Alter.Table("bar").AlterColumn("foo").AsGuid().NotNullable().Do(); - } } - [NUnit.Framework.Ignore("this doesn't actually test anything")] + [Ignore("this doesn't actually test anything")] [Test] public void Can_Get_Up_Migration_From_MigrationStub() { @@ -131,7 +117,7 @@ namespace Umbraco.Tests.Migrations //Console output Debug.Print("Number of expressions in context: {0}", database.Operations.Count); Debug.Print(""); - foreach (var expression in database.Operations) + foreach (TestDatabase.Operation expression in database.Operations) { Debug.Print(expression.ToString()); } diff --git a/src/Umbraco.Tests/Migrations/MigrationPlanTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/MigrationPlanTests.cs similarity index 83% rename from src/Umbraco.Tests/Migrations/MigrationPlanTests.cs rename to src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/MigrationPlanTests.cs index 0a8c6cfb3f..0511ee6290 100644 --- a/src/Umbraco.Tests/Migrations/MigrationPlanTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/MigrationPlanTests.cs @@ -10,14 +10,13 @@ using Umbraco.Core; using Umbraco.Core.Migrations; using Umbraco.Core.Migrations.Upgrade; using Umbraco.Core.Persistence; +using Umbraco.Core.Persistence.SqlSyntax; using Umbraco.Core.Scoping; using Umbraco.Core.Services; -using Umbraco.Persistance.SqlCe; -using Umbraco.Tests.Common.Builders; using Umbraco.Tests.TestHelpers; using Umbraco.Tests.Testing; -namespace Umbraco.Tests.Migrations +namespace Umbraco.Tests.UnitTests.Umbraco.Infrastructure.Migrations { [TestFixture] public class MigrationPlanTests @@ -25,18 +24,19 @@ namespace Umbraco.Tests.Migrations [Test] public void CanExecute() { - var loggerFactory = NullLoggerFactory.Instance; + NullLoggerFactory loggerFactory = NullLoggerFactory.Instance; var database = new TestDatabase(); - var scope = Mock.Of(); + IScope scope = Mock.Of(); Mock.Get(scope) .Setup(x => x.Database) .Returns(database); - var sqlContext = new SqlContext(new SqlCeSyntaxProvider(), DatabaseType.SQLCe, Mock.Of()); + var sqlContext = new SqlContext(new SqlServerSyntaxProvider(), DatabaseType.SQLCe, + Mock.Of()); var scopeProvider = new MigrationTests.TestScopeProvider(scope) { SqlContext = sqlContext }; - var migrationBuilder = Mock.Of(); + IMigrationBuilder migrationBuilder = Mock.Of(); Mock.Get(migrationBuilder) .Setup(x => x.Build(It.IsAny(), It.IsAny())) .Returns((t, c) => @@ -52,22 +52,24 @@ namespace Umbraco.Tests.Migrations } }); - var plan = new MigrationPlan("default") + MigrationPlan plan = new MigrationPlan("default") .From(string.Empty) .To("{4A9A1A8F-0DA1-4BCF-AD06-C19D79152E35}") .To("VERSION.33"); - var kvs = Mock.Of(); - Mock.Get(kvs).Setup(x => x.GetValue(It.IsAny())).Returns(k => k == "Umbraco.Tests.MigrationPlan" ? string.Empty : null); + IKeyValueService kvs = Mock.Of(); + Mock.Get(kvs).Setup(x => x.GetValue(It.IsAny())) + .Returns(k => k == "Umbraco.Tests.MigrationPlan" ? string.Empty : null); string state; - using (var s = scopeProvider.CreateScope()) + using (IScope s = scopeProvider.CreateScope()) { // read current state var sourceState = kvs.GetValue("Umbraco.Tests.MigrationPlan") ?? string.Empty; // execute plan - state = plan.Execute(s, sourceState, migrationBuilder, loggerFactory.CreateLogger(), loggerFactory); + state = plan.Execute(s, sourceState, migrationBuilder, loggerFactory.CreateLogger(), + loggerFactory); // save new state kvs.SetValue("Umbraco.Tests.MigrationPlan", sourceState, state); @@ -178,11 +180,11 @@ namespace Umbraco.Tests.Migrations .From(string.Empty) .To("aaa") .Merge() - .To("bbb") - .To("ccc") + .To("bbb") + .To("ccc") .With() - .To("ddd") - .To("eee") + .To("ddd") + .To("eee") .As("fff") .To("ggg"); @@ -198,8 +200,12 @@ namespace Umbraco.Tests.Migrations { Assert.AreEqual(expected.Length, states.Count, string.Join(", ", states)); for (var i = 0; i < expected.Length; i++) + { if (expected[i] != "*") + { Assert.AreEqual(expected[i], states[i], "at:" + i); + } + } } private void WritePlanToConsole(MigrationPlan plan) @@ -207,21 +213,23 @@ namespace Umbraco.Tests.Migrations var final = plan.Transitions.First(x => x.Value == null).Key; Console.WriteLine("plan \"{0}\" to final state \"{1}\":", plan.Name, final); - foreach (var (_, transition) in plan.Transitions) + foreach ((var _, MigrationPlan.Transition transition) in plan.Transitions) + { if (transition != null) + { Console.WriteLine(transition); + } + } } public class DeleteRedirectUrlTable : MigrationBase { public DeleteRedirectUrlTable(IMigrationContext context) : base(context) - { } - - public override void Migrate() { - Delete.Table("umbracoRedirectUrl").Do(); } + + public override void Migrate() => Delete.Table("umbracoRedirectUrl").Do(); } } } diff --git a/src/Umbraco.Tests/Migrations/MigrationTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/MigrationTests.cs similarity index 55% rename from src/Umbraco.Tests/Migrations/MigrationTests.cs rename to src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/MigrationTests.cs index 46d9b04b1b..34093d0bce 100644 --- a/src/Umbraco.Tests/Migrations/MigrationTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/MigrationTests.cs @@ -1,18 +1,14 @@ using System; -using System.Collections.Generic; using System.Data; using Microsoft.Extensions.Logging; using Moq; using NUnit.Framework; -using Semver; using Umbraco.Core.Events; using Umbraco.Core.Migrations; -using Umbraco.Core.Migrations.Upgrade; using Umbraco.Core.Persistence; using Umbraco.Core.Scoping; -using Umbraco.Core.Services; -namespace Umbraco.Tests.Migrations +namespace Umbraco.Tests.UnitTests.Umbraco.Infrastructure.Migrations { [TestFixture] public class MigrationTests @@ -21,35 +17,30 @@ namespace Umbraco.Tests.Migrations { private readonly IScope _scope; - public TestScopeProvider(IScope scope) - { - _scope = scope; - } + public TestScopeProvider(IScope scope) => _scope = scope; - public IScope CreateScope(IsolationLevel isolationLevel = IsolationLevel.Unspecified, RepositoryCacheMode repositoryCacheMode = RepositoryCacheMode.Unspecified, IEventDispatcher eventDispatcher = null, bool? scopeFileSystems = null, bool callContext = false, bool autoComplete = false) - { - return _scope; - } + public IScope CreateScope( + IsolationLevel isolationLevel = IsolationLevel.Unspecified, + RepositoryCacheMode repositoryCacheMode = RepositoryCacheMode.Unspecified, + IEventDispatcher eventDispatcher = null, + bool? scopeFileSystems = null, + bool callContext = false, + bool autoComplete = false) => _scope; - public IScope CreateDetachedScope(IsolationLevel isolationLevel = IsolationLevel.Unspecified, RepositoryCacheMode repositoryCacheMode = RepositoryCacheMode.Unspecified, IEventDispatcher eventDispatcher = null, bool? scopeFileSystems = null) - { - throw new NotImplementedException(); - } + public IScope CreateDetachedScope( + IsolationLevel isolationLevel = IsolationLevel.Unspecified, + RepositoryCacheMode repositoryCacheMode = RepositoryCacheMode.Unspecified, + IEventDispatcher eventDispatcher = null, + bool? scopeFileSystems = null) => throw new NotImplementedException(); - public void AttachScope(IScope scope, bool callContext = false) - { - throw new NotImplementedException(); - } - - public IScope DetachScope() - { - throw new NotImplementedException(); - } + public void AttachScope(IScope scope, bool callContext = false) => throw new NotImplementedException(); + public IScope DetachScope() => throw new NotImplementedException(); public IScopeContext Context { get; set; } - public ISqlContext SqlContext { get; set; } + + public ISqlContext SqlContext { get; set; } #if DEBUG_SCOPES public ScopeInfo GetScopeInfo(IScope scope) @@ -63,7 +54,8 @@ namespace Umbraco.Tests.Migrations [Test] public void RunGoodMigration() { - var migrationContext = new MigrationContext(Mock.Of(), Mock.Of>()); + var migrationContext = + new MigrationContext(Mock.Of(), Mock.Of>()); IMigration migration = new GoodMigration(migrationContext); migration.Migrate(); } @@ -71,7 +63,8 @@ namespace Umbraco.Tests.Migrations [Test] public void DetectBadMigration1() { - var migrationContext = new MigrationContext(Mock.Of(), Mock.Of>()); + var migrationContext = + new MigrationContext(Mock.Of(), Mock.Of>()); IMigration migration = new BadMigration1(migrationContext); Assert.Throws(() => migration.Migrate()); } @@ -79,7 +72,8 @@ namespace Umbraco.Tests.Migrations [Test] public void DetectBadMigration2() { - var migrationContext = new MigrationContext(Mock.Of(), Mock.Of>()); + var migrationContext = + new MigrationContext(Mock.Of(), Mock.Of>()); IMigration migration = new BadMigration2(migrationContext); Assert.Throws(() => migration.Migrate()); } @@ -88,31 +82,28 @@ namespace Umbraco.Tests.Migrations { public GoodMigration(IMigrationContext context) : base(context) - { } - - public override void Migrate() { - Execute.Sql("").Do(); } + + public override void Migrate() => Execute.Sql("").Do(); } public class BadMigration1 : MigrationBase { public BadMigration1(IMigrationContext context) : base(context) - { } - - public override void Migrate() { - Alter.Table("foo"); // stop here, don't Do it } + + public override void Migrate() => Alter.Table("foo"); // stop here, don't Do it } public class BadMigration2 : MigrationBase { public BadMigration2(IMigrationContext context) : base(context) - { } + { + } public override void Migrate() { diff --git a/src/Umbraco.Tests/Migrations/PostMigrationTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/PostMigrationTests.cs similarity index 71% rename from src/Umbraco.Tests/Migrations/PostMigrationTests.cs rename to src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/PostMigrationTests.cs index ba265b3fd2..2b3e626d03 100644 --- a/src/Umbraco.Tests/Migrations/PostMigrationTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/PostMigrationTests.cs @@ -1,6 +1,6 @@ using System; -using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; using Moq; using NPoco; using NUnit.Framework; @@ -10,19 +10,19 @@ using Umbraco.Core.Persistence; using Umbraco.Core.Persistence.SqlSyntax; using Umbraco.Core.Scoping; using Umbraco.Core.Services; -using Umbraco.Persistance.SqlCe; using Umbraco.Tests.Testing; -namespace Umbraco.Tests.Migrations +namespace Umbraco.Tests.UnitTests.Umbraco.Infrastructure.Migrations { [TestFixture] public class PostMigrationTests { - private static ILoggerFactory _loggerFactory = NullLoggerFactory.Instance; + private static readonly ILoggerFactory s_loggerFactory = NullLoggerFactory.Instance; + [Test] public void ExecutesPlanPostMigration() { - var builder = Mock.Of(); + IMigrationBuilder builder = Mock.Of(); Mock.Get(builder) .Setup(x => x.Build(It.IsAny(), It.IsAny())) .Returns((t, c) => @@ -39,22 +39,30 @@ namespace Umbraco.Tests.Migrations }); var database = new TestDatabase(); - var scope = Mock.Of(); + IScope scope = Mock.Of(); Mock.Get(scope) .Setup(x => x.Database) .Returns(database); - var sqlContext = new SqlContext(new SqlCeSyntaxProvider(), DatabaseType.SQLCe, Mock.Of()); + var sqlContext = new SqlContext( + new SqlServerSyntaxProvider(), + DatabaseType.SQLCe, + Mock.Of()); var scopeProvider = new MigrationTests.TestScopeProvider(scope) { SqlContext = sqlContext }; - var plan = new MigrationPlan("Test") + MigrationPlan plan = new MigrationPlan("Test") .From(string.Empty).To("done"); plan.AddPostMigration(); TestPostMigration.MigrateCount = 0; var upgrader = new Upgrader(plan); - upgrader.Execute(scopeProvider, builder, Mock.Of(), _loggerFactory.CreateLogger(), _loggerFactory); + upgrader.Execute( + scopeProvider, + builder, + Mock.Of(), + s_loggerFactory.CreateLogger(), + s_loggerFactory); Assert.AreEqual(1, TestPostMigration.MigrateCount); } @@ -62,7 +70,7 @@ namespace Umbraco.Tests.Migrations [Test] public void MigrationCanAddPostMigration() { - var builder = Mock.Of(); + IMigrationBuilder builder = Mock.Of(); Mock.Get(builder) .Setup(x => x.Build(It.IsAny(), It.IsAny())) .Returns((t, c) => @@ -81,24 +89,32 @@ namespace Umbraco.Tests.Migrations }); var database = new TestDatabase(); - var scope = Mock.Of(); + IScope scope = Mock.Of(); Mock.Get(scope) .Setup(x => x.Database) .Returns(database); - var sqlContext = new SqlContext(new SqlCeSyntaxProvider(), DatabaseType.SQLCe, Mock.Of()); + var sqlContext = new SqlContext( + new SqlServerSyntaxProvider(), + DatabaseType.SQLCe, + Mock.Of()); var scopeProvider = new MigrationTests.TestScopeProvider(scope) { SqlContext = sqlContext }; - var plan = new MigrationPlan("Test") + MigrationPlan plan = new MigrationPlan("Test") .From(string.Empty).To("done"); TestMigration.MigrateCount = 0; TestPostMigration.MigrateCount = 0; - new MigrationContext(database, _loggerFactory.CreateLogger()); + new MigrationContext(database, s_loggerFactory.CreateLogger()); var upgrader = new Upgrader(plan); - upgrader.Execute(scopeProvider, builder, Mock.Of(), _loggerFactory.CreateLogger(), _loggerFactory); + upgrader.Execute( + scopeProvider, + builder, + Mock.Of(), + s_loggerFactory.CreateLogger(), + s_loggerFactory); Assert.AreEqual(1, TestMigration.MigrateCount); Assert.AreEqual(1, TestPostMigration.MigrateCount); @@ -108,7 +124,8 @@ namespace Umbraco.Tests.Migrations { public TestMigration(IMigrationContext context) : base(context) - { } + { + } public static int MigrateCount { get; set; } @@ -124,10 +141,7 @@ namespace Umbraco.Tests.Migrations { public static int MigrateCount { get; set; } - public void Migrate() - { - MigrateCount++; - } + public void Migrate() => MigrateCount++; } } } diff --git a/src/Umbraco.Tests/Migrations/Stubs/AlterUserTableMigrationStub.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/Stubs/AlterUserTableMigrationStub.cs similarity index 100% rename from src/Umbraco.Tests/Migrations/Stubs/AlterUserTableMigrationStub.cs rename to src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/Stubs/AlterUserTableMigrationStub.cs diff --git a/src/Umbraco.Tests/Migrations/Stubs/DropForeignKeyMigrationStub.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/Stubs/DropForeignKeyMigrationStub.cs similarity index 100% rename from src/Umbraco.Tests/Migrations/Stubs/DropForeignKeyMigrationStub.cs rename to src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/Stubs/DropForeignKeyMigrationStub.cs diff --git a/src/Umbraco.Tests/Migrations/Stubs/Dummy.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/Stubs/Dummy.cs similarity index 100% rename from src/Umbraco.Tests/Migrations/Stubs/Dummy.cs rename to src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/Stubs/Dummy.cs diff --git a/src/Umbraco.Tests/Migrations/Stubs/FiveZeroMigration.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/Stubs/FiveZeroMigration.cs similarity index 100% rename from src/Umbraco.Tests/Migrations/Stubs/FiveZeroMigration.cs rename to src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/Stubs/FiveZeroMigration.cs diff --git a/src/Umbraco.Tests/Migrations/Stubs/FourElevenMigration.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/Stubs/FourElevenMigration.cs similarity index 100% rename from src/Umbraco.Tests/Migrations/Stubs/FourElevenMigration.cs rename to src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/Stubs/FourElevenMigration.cs diff --git a/src/Umbraco.Tests/Migrations/Stubs/SixZeroMigration1.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/Stubs/SixZeroMigration1.cs similarity index 100% rename from src/Umbraco.Tests/Migrations/Stubs/SixZeroMigration1.cs rename to src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/Stubs/SixZeroMigration1.cs diff --git a/src/Umbraco.Tests/Migrations/Stubs/SixZeroMigration2.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/Stubs/SixZeroMigration2.cs similarity index 100% rename from src/Umbraco.Tests/Migrations/Stubs/SixZeroMigration2.cs rename to src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/Stubs/SixZeroMigration2.cs diff --git a/src/Umbraco.Tests/Cache/SnapDictionaryTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.PublishedCache.NuCache/SnapDictionaryTests.cs similarity index 99% rename from src/Umbraco.Tests/Cache/SnapDictionaryTests.cs rename to src/Umbraco.Tests.UnitTests/Umbraco.PublishedCache.NuCache/SnapDictionaryTests.cs index 739268b451..91317848c6 100644 --- a/src/Umbraco.Tests/Cache/SnapDictionaryTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.PublishedCache.NuCache/SnapDictionaryTests.cs @@ -1,4 +1,5 @@ -using System; + +using System; using System.Linq; using System.Threading.Tasks; using Moq; @@ -6,7 +7,7 @@ using NUnit.Framework; using Umbraco.Core.Scoping; using Umbraco.Web.PublishedCache.NuCache; -namespace Umbraco.Tests.Cache +namespace Umbraco.Tests.UnitTests.Umbraco.Umbraco.PublishedCache { [TestFixture] public class SnapDictionaryTests diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Tests.UnitTests.csproj b/src/Umbraco.Tests.UnitTests/Umbraco.Tests.UnitTests.csproj index 76764d0483..1e774f4b00 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Tests.UnitTests.csproj +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Tests.UnitTests.csproj @@ -8,6 +8,7 @@ + diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Web.Website/Controllers/SurfaceControllerTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Web.Website/Controllers/SurfaceControllerTests.cs index e9fef92a3c..82bd6719d4 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Web.Website/Controllers/SurfaceControllerTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Web.Website/Controllers/SurfaceControllerTests.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Routing; @@ -38,7 +38,6 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Web.Website.Controllers [Test] public void Can_Construct_And_Get_Result() { - var httpContextAccessor = Mock.Of(); var hostingEnvironment = Mock.Of(); var backofficeSecurityAccessor = Mock.Of(); Mock.Get(backofficeSecurityAccessor).Setup(x => x.BackOfficeSecurity).Returns(Mock.Of()); @@ -50,10 +49,8 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Web.Website.Controllers new TestVariationContextAccessor(), new TestDefaultCultureAccessor(), Options.Create(globalSettings), - Mock.Of(), hostingEnvironment, new UriUtility(hostingEnvironment), - httpContextAccessor, Mock.Of(), Mock.Of(), backofficeSecurityAccessor); @@ -74,7 +71,6 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Web.Website.Controllers public void Umbraco_Context_Not_Null() { var globalSettings = new GlobalSettings(); - var httpContextAccessor = Mock.Of(); var hostingEnvironment = Mock.Of(); var backofficeSecurityAccessor = Mock.Of(); Mock.Get(backofficeSecurityAccessor).Setup(x => x.BackOfficeSecurity).Returns(Mock.Of()); @@ -84,10 +80,8 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Web.Website.Controllers new TestVariationContextAccessor(), new TestDefaultCultureAccessor(), Options.Create(globalSettings), - Mock.Of(), hostingEnvironment, new UriUtility(hostingEnvironment), - httpContextAccessor, Mock.Of(), Mock.Of(), backofficeSecurityAccessor); @@ -112,7 +106,6 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Web.Website.Controllers var backofficeSecurityAccessor = Mock.Of(); Mock.Get(backofficeSecurityAccessor).Setup(x => x.BackOfficeSecurity).Returns(Mock.Of()); var publishedSnapshotService = new Mock(); - var httpContextAccessor = Mock.Of(); var hostingEnvironment = Mock.Of(); var globalSettings = new GlobalSettings(); @@ -122,10 +115,8 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Web.Website.Controllers new TestVariationContextAccessor(), new TestDefaultCultureAccessor(), Options.Create(globalSettings), - Mock.Of(), hostingEnvironment, new UriUtility(hostingEnvironment), - httpContextAccessor, Mock.Of(), Mock.Of(), backofficeSecurityAccessor); @@ -150,7 +141,6 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Web.Website.Controllers public void Mock_Current_Page() { var globalSettings = new GlobalSettings(); - var httpContextAccessor = Mock.Of(); var hostingEnvironment = Mock.Of(); var backofficeSecurityAccessor = Mock.Of(); Mock.Get(backofficeSecurityAccessor).Setup(x => x.BackOfficeSecurity).Returns(Mock.Of()); @@ -160,10 +150,8 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Web.Website.Controllers new TestVariationContextAccessor(), new TestDefaultCultureAccessor(), Options.Create(globalSettings), - Mock.Of(), hostingEnvironment, new UriUtility(hostingEnvironment), - httpContextAccessor, Mock.Of(), Mock.Of(), backofficeSecurityAccessor); diff --git a/src/Umbraco.Tests/Migrations/SqlScripts/SqlCe-SchemaAndData-4110.sql b/src/Umbraco.Tests/Migrations/SqlScripts/SqlCe-SchemaAndData-4110.sql deleted file mode 100644 index 4aeb066f54..0000000000 Binary files a/src/Umbraco.Tests/Migrations/SqlScripts/SqlCe-SchemaAndData-4110.sql and /dev/null differ diff --git a/src/Umbraco.Tests/Migrations/SqlScripts/SqlCeTotal-480.sql b/src/Umbraco.Tests/Migrations/SqlScripts/SqlCeTotal-480.sql deleted file mode 100644 index f814b7fc2d..0000000000 --- a/src/Umbraco.Tests/Migrations/SqlScripts/SqlCeTotal-480.sql +++ /dev/null @@ -1,638 +0,0 @@ -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]) -; - -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 deleted file mode 100644 index 7a7cee0ce3..0000000000 --- a/src/Umbraco.Tests/Migrations/SqlScripts/SqlResources.Designer.cs +++ /dev/null @@ -1,143 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// 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", "16.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 CREATE TABLE [umbracoUserType] ( - /// [id] int NOT NULL IDENTITY (5,1) - ///, [userTypeAlias] nvarchar(50) NULL - ///, [userTypeName] nvarchar(255) NOT NULL - ///, [userTypeDefaultPermissions] nvarchar(50) NULL - ///); - ///GO - ///CREATE TABLE [umbracoUser2NodePermission] ( - /// [userId] int NOT NULL - ///, [nodeId] int NOT NULL - ///, [permission] nchar(1) NOT NULL - ///); - ///GO - ///CREATE TABLE [umbracoUser2NodeNotify] ( - /// [userId] int NOT NULL - ///, [nodeId] int NOT NULL - ///, [action] nchar(1) NOT NULL - ///); - ///GO - ///CREATE TABLE [umbracoUser] ( - /// [id] in [rest of string was truncated]";. - /// - internal static string SqlCe_SchemaAndData_4110 { - get { - return ResourceManager.GetString("SqlCe_SchemaAndData_4110", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 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 [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 deleted file mode 100644 index 20ba6d0e8e..0000000000 --- a/src/Umbraco.Tests/Migrations/SqlScripts/SqlResources.resx +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - sqlcetotal-480.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - - sqlce-schemaanddata-4110.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16 - - - sqlservertotal-480.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - diff --git a/src/Umbraco.Tests/Migrations/SqlScripts/SqlServerTotal-480.sql b/src/Umbraco.Tests/Migrations/SqlScripts/SqlServerTotal-480.sql deleted file mode 100644 index e69d87f759..0000000000 --- a/src/Umbraco.Tests/Migrations/SqlScripts/SqlServerTotal-480.sql +++ /dev/null @@ -1,1671 +0,0 @@ -/******************************************************************************************* - - - - - - - - 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]) -; -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'Textarea', '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'memberGroups', 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'memberTypes', 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'documentTypes', 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'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 - -***********************************************************************************************************************/ diff --git a/src/Umbraco.Tests/TestHelpers/BaseUsingSqlCeSyntax.cs b/src/Umbraco.Tests/TestHelpers/BaseUsingSqlCeSyntax.cs index 6e27bdd07c..adc076caec 100644 --- a/src/Umbraco.Tests/TestHelpers/BaseUsingSqlCeSyntax.cs +++ b/src/Umbraco.Tests/TestHelpers/BaseUsingSqlCeSyntax.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -43,7 +43,7 @@ namespace Umbraco.Tests.TestHelpers var logger = new ProfilingLogger(Mock.Of>(), Mock.Of()); var typeFinder = TestHelper.GetTypeFinder(); var typeLoader = new TypeLoader(typeFinder, NoAppCache.Instance, - new DirectoryInfo(ioHelper.MapPath("~/App_Data/TEMP")), + new DirectoryInfo(ioHelper.MapPath(Constants.SystemDirectories.TempData)), Mock.Of>(), logger, false); diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 74eed99143..807c64f315 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -129,16 +129,11 @@ - - - - - @@ -160,12 +155,10 @@ - - @@ -186,27 +179,18 @@ - - - - - - - - - @@ -218,15 +202,6 @@ - - - True - True - SqlResources.resx - - - - @@ -336,11 +311,6 @@ - - ResXFileCodeGenerator - SqlResources.Designer.cs - Designer - ResXFileCodeGenerator ImportResources.Designer.cs @@ -353,10 +323,6 @@ - - - - Designer diff --git a/src/Umbraco.Web.BackOffice/Controllers/ContentTypeController.cs b/src/Umbraco.Web.BackOffice/Controllers/ContentTypeController.cs index aa2a57b123..fe910fbd32 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/ContentTypeController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/ContentTypeController.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -659,7 +659,7 @@ namespace Umbraco.Web.BackOffice.Controllers } catch (Exception ex) { - _logger.LogError(ex, "Error cleaning up temporary udt file in App_Data: {File}", filePath); + _logger.LogError(ex, "Error cleaning up temporary udt file in {File}", filePath); } return Ok(); diff --git a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs index f67e062847..6b06db315c 100644 --- a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs +++ b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs @@ -10,7 +10,7 @@ namespace Umbraco.Web.Common.AspNetCore { public class AspNetCoreHostingEnvironment : Core.Hosting.IHostingEnvironment { - private IOptionsMonitor _hostingSettings; + private IOptionsMonitor _hostingSettings; private readonly IWebHostEnvironment _webHostEnvironment; private string _localTempPath; @@ -27,59 +27,67 @@ namespace Umbraco.Web.Common.AspNetCore IISVersion = new Version(0, 0); // TODO not necessary IIS } + /// public bool IsHosted { get; } = true; + + /// public string SiteName { get; } + + /// public string ApplicationId { get; } + + /// public string ApplicationPhysicalPath { get; } + public string ApplicationServerAddress { get; } - //TODO how to find this, This is a server thing, not application thing. + // TODO how to find this, This is a server thing, not application thing. public string ApplicationVirtualPath => _hostingSettings.CurrentValue.ApplicationVirtualPath?.EnsureStartsWith('/') ?? "/"; + + /// public bool IsDebugMode => _hostingSettings.CurrentValue.Debug; public Version IISVersion { get; } + public string LocalTempPath { get { if (_localTempPath != null) + { return _localTempPath; + } switch (_hostingSettings.CurrentValue.LocalTempStorageLocation) { - case LocalTempStorage.AspNetTemp: - - // TODO: I don't think this is correct? but also we probably can remove AspNetTemp as an option entirely - // since this is legacy and we shouldn't use it - return _localTempPath = System.IO.Path.Combine(Path.GetTempPath(), ApplicationId, "UmbracoData"); - case LocalTempStorage.EnvironmentTemp: // environment temp is unique, we need a folder per site // use a hash // combine site name and application id - // site name is a Guid on Cloud - // application id is eg /LM/W3SVC/123456/ROOT + // site name is a Guid on Cloud + // application id is eg /LM/W3SVC/123456/ROOT // the combination is unique on one server // and, if a site moves from worker A to B and then back to A... - // hopefully it gets a new Guid or new application id? - - var hashString = SiteName + "::" + ApplicationId; - var hash = hashString.GenerateHash(); - var siteTemp = System.IO.Path.Combine(Environment.ExpandEnvironmentVariables("%temp%"), "UmbracoData", hash); + // hopefully it gets a new Guid or new application id? + string hashString = SiteName + "::" + ApplicationId; + string hash = hashString.GenerateHash(); + string siteTemp = Path.Combine(Environment.ExpandEnvironmentVariables("%temp%"), "UmbracoData", hash); return _localTempPath = siteTemp; - //case LocalTempStorage.Default: - //case LocalTempStorage.Unknown: default: - return _localTempPath = MapPathContentRoot("~/App_Data/TEMP"); + + return _localTempPath = MapPathContentRoot(Core.Constants.SystemDirectories.TempData); } } } + /// public string MapPathWebRoot(string path) => MapPath(_webHostEnvironment.WebRootPath, path); + + /// public string MapPathContentRoot(string path) => MapPath(_webHostEnvironment.ContentRootPath, path); private string MapPath(string root, string path) @@ -91,21 +99,29 @@ namespace Umbraco.Web.Common.AspNetCore // however if you are requesting a path be mapped, it should always assume the path is relative to the root, not // absolute in the file system. This error will help us find and fix improper uses, and should be removed once // all those uses have been found and fixed - if (newPath.StartsWith(root)) throw new ArgumentException("The path appears to already be fully qualified. Please remove the call to MapPath"); + if (newPath.StartsWith(root)) + { + throw new ArgumentException("The path appears to already be fully qualified. Please remove the call to MapPath"); + } return Path.Combine(root, newPath.TrimStart('~', '/', '\\')); } + /// public string ToAbsolute(string virtualPath) { if (!virtualPath.StartsWith("~/") && !virtualPath.StartsWith("/")) + { throw new InvalidOperationException($"The value {virtualPath} for parameter {nameof(virtualPath)} must start with ~/ or /"); + } // will occur if it starts with "/" if (Uri.IsWellFormedUriString(virtualPath, UriKind.Absolute)) + { return virtualPath; + } - var fullPath = ApplicationVirtualPath.EnsureEndsWith('/') + virtualPath.TrimStart('~', '/'); + string fullPath = ApplicationVirtualPath.EnsureEndsWith('/') + virtualPath.TrimStart('~', '/'); return fullPath; } diff --git a/src/Umbraco.Web.Common/Builder/UmbracoBuilderExtensions.cs b/src/Umbraco.Web.Common/Builder/UmbracoBuilderExtensions.cs index f346e0dd79..e72089b8fe 100644 --- a/src/Umbraco.Web.Common/Builder/UmbracoBuilderExtensions.cs +++ b/src/Umbraco.Web.Common/Builder/UmbracoBuilderExtensions.cs @@ -53,13 +53,20 @@ namespace Umbraco.Core.DependencyInjection IConfiguration config) { if (services is null) + { throw new ArgumentNullException(nameof(services)); + } + if (config is null) + { throw new ArgumentNullException(nameof(config)); + } - var loggingConfig = new LoggingConfiguration(Path.Combine(webHostEnvironment.ContentRootPath, "umbraco", "logs")); + IHostingEnvironment tempHostingEnvironment = GetTemporaryHostingEnvironment(webHostEnvironment, config); + + var loggingDir = tempHostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.LogFiles); + var loggingConfig = new LoggingConfiguration(loggingDir); - var tempHostingEnvironment = GetTemporaryHostingEnvironment(webHostEnvironment, config); services.AddLogger(tempHostingEnvironment, loggingConfig, config); IHttpContextAccessor httpContextAccessor = new HttpContextAccessor(); @@ -69,11 +76,11 @@ namespace Umbraco.Core.DependencyInjection var appCaches = AppCaches.Create(requestCache); services.AddUnique(appCaches); - var profiler = GetWebProfiler(config); + IProfiler profiler = GetWebProfiler(config); services.AddUnique(profiler); - var loggerFactory = LoggerFactory.Create(cfg => cfg.AddSerilog(Log.Logger, false)); - var typeLoader = services.AddTypeLoader(Assembly.GetEntryAssembly(), webHostEnvironment, tempHostingEnvironment, loggerFactory, appCaches, config, profiler); + ILoggerFactory loggerFactory = LoggerFactory.Create(cfg => cfg.AddSerilog(Log.Logger, false)); + TypeLoader typeLoader = services.AddTypeLoader(Assembly.GetEntryAssembly(), webHostEnvironment, tempHostingEnvironment, loggerFactory, appCaches, config, profiler); return new UmbracoBuilder(services, config, typeLoader, loggerFactory); } diff --git a/src/Umbraco.Web.Common/UmbracoContext/UmbracoContext.cs b/src/Umbraco.Web.Common/UmbracoContext/UmbracoContext.cs index 56dd4b054e..97bb9ac7c4 100644 --- a/src/Umbraco.Web.Common/UmbracoContext/UmbracoContext.cs +++ b/src/Umbraco.Web.Common/UmbracoContext/UmbracoContext.cs @@ -1,4 +1,4 @@ -using System; +using System; using Umbraco.Core; using Umbraco.Core.Configuration.Models; using Umbraco.Core.Hosting; @@ -21,7 +21,7 @@ namespace Umbraco.Web private readonly Lazy _publishedSnapshot; private string _previewToken; private bool? _previewing; - private IBackOfficeSecurity _backofficeSecurity; + private readonly IBackOfficeSecurity _backofficeSecurity; // initializes a new instance of the UmbracoContext class // internal for unit tests @@ -37,7 +37,11 @@ namespace Umbraco.Web ICookieManager cookieManager, IRequestAccessor requestAccessor) { - if (publishedSnapshotService == null) throw new ArgumentNullException(nameof(publishedSnapshotService)); + if (publishedSnapshotService == null) + { + throw new ArgumentNullException(nameof(publishedSnapshotService)); + } + VariationContextAccessor = variationContextAccessor ?? throw new ArgumentNullException(nameof(variationContextAccessor)); _globalSettings = globalSettings ?? throw new ArgumentNullException(nameof(globalSettings)); diff --git a/src/Umbraco.Web.Common/UmbracoContext/UmbracoContextFactory.cs b/src/Umbraco.Web.Common/UmbracoContext/UmbracoContextFactory.cs index 553ea07a90..9dd4939c3d 100644 --- a/src/Umbraco.Web.Common/UmbracoContext/UmbracoContextFactory.cs +++ b/src/Umbraco.Web.Common/UmbracoContext/UmbracoContextFactory.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Text; using Microsoft.AspNetCore.Http; @@ -26,9 +26,7 @@ namespace Umbraco.Web private readonly IDefaultCultureAccessor _defaultCultureAccessor; private readonly GlobalSettings _globalSettings; - private readonly IUserService _userService; private readonly IHostingEnvironment _hostingEnvironment; - private readonly IHttpContextAccessor _httpContextAccessor; private readonly ICookieManager _cookieManager; private readonly IRequestAccessor _requestAccessor; private readonly IBackOfficeSecurityAccessor _backofficeSecurityAccessor; @@ -43,23 +41,19 @@ namespace Umbraco.Web IVariationContextAccessor variationContextAccessor, IDefaultCultureAccessor defaultCultureAccessor, IOptions globalSettings, - IUserService userService, IHostingEnvironment hostingEnvironment, UriUtility uriUtility, - IHttpContextAccessor httpContextAccessor, ICookieManager cookieManager, IRequestAccessor requestAccessor, - IBackOfficeSecurityAccessor backofficeSecurityAccessor) + IBackOfficeSecurityAccessor backofficeSecurityAccessor) { _umbracoContextAccessor = umbracoContextAccessor ?? throw new ArgumentNullException(nameof(umbracoContextAccessor)); _publishedSnapshotService = publishedSnapshotService ?? throw new ArgumentNullException(nameof(publishedSnapshotService)); _variationContextAccessor = variationContextAccessor ?? throw new ArgumentNullException(nameof(variationContextAccessor)); _defaultCultureAccessor = defaultCultureAccessor ?? throw new ArgumentNullException(nameof(defaultCultureAccessor)); _globalSettings = globalSettings.Value ?? throw new ArgumentNullException(nameof(globalSettings)); - _userService = userService ?? throw new ArgumentNullException(nameof(userService)); _hostingEnvironment = hostingEnvironment ?? throw new ArgumentNullException(nameof(hostingEnvironment)); _uriUtility = uriUtility ?? throw new ArgumentNullException(nameof(uriUtility)); - _httpContextAccessor = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor)); _cookieManager = cookieManager ?? throw new ArgumentNullException(nameof(cookieManager)); _requestAccessor = requestAccessor ?? throw new ArgumentNullException(nameof(requestAccessor)); _backofficeSecurityAccessor = backofficeSecurityAccessor ?? throw new ArgumentNullException(nameof(backofficeSecurityAccessor)); @@ -92,11 +86,13 @@ namespace Umbraco.Web /// public UmbracoContextReference EnsureUmbracoContext() { - var currentUmbracoContext = _umbracoContextAccessor.UmbracoContext; + IUmbracoContext currentUmbracoContext = _umbracoContextAccessor.UmbracoContext; if (currentUmbracoContext != null) + { return new UmbracoContextReference(currentUmbracoContext, false, _umbracoContextAccessor); + } - var umbracoContext = CreateUmbracoContext(); + IUmbracoContext umbracoContext = CreateUmbracoContext(); _umbracoContextAccessor.UmbracoContext = umbracoContext; return new UmbracoContextReference(umbracoContext, true, _umbracoContextAccessor); diff --git a/src/Umbraco.Web/AspNet/AspNetHostingEnvironment.cs b/src/Umbraco.Web/AspNet/AspNetHostingEnvironment.cs index cc8fc975d2..ec9d66859e 100644 --- a/src/Umbraco.Web/AspNet/AspNetHostingEnvironment.cs +++ b/src/Umbraco.Web/AspNet/AspNetHostingEnvironment.cs @@ -11,6 +11,7 @@ using Umbraco.Core.Hosting; namespace Umbraco.Web.Hosting { + // TODO: This has been migrated to netcore public class AspNetHostingEnvironment : IHostingEnvironment { @@ -67,9 +68,6 @@ namespace Umbraco.Web.Hosting switch (_hostingSettings.LocalTempStorageLocation) { - case LocalTempStorage.AspNetTemp: - return _localTempPath = System.IO.Path.Combine(HttpRuntime.CodegenDir, "UmbracoData"); - case LocalTempStorage.EnvironmentTemp: // environment temp is unique, we need a folder per site @@ -88,10 +86,8 @@ namespace Umbraco.Web.Hosting return _localTempPath = siteTemp; - //case LocalTempStorage.Default: - //case LocalTempStorage.Unknown: default: - return _localTempPath = MapPathContentRoot("~/App_Data/TEMP"); + return _localTempPath = MapPathContentRoot(Constants.SystemDirectories.TempData); } } } diff --git a/src/Umbraco.Web/Macros/PartialViewMacroPage.cs b/src/Umbraco.Web/Macros/PartialViewMacroPage.cs deleted file mode 100644 index 7297fec6d3..0000000000 --- a/src/Umbraco.Web/Macros/PartialViewMacroPage.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Umbraco.Web.Models; -using Umbraco.Web.Mvc; - -namespace Umbraco.Web.Macros -{ - /// - /// The base view class that PartialViewMacro views need to inherit from - /// - public abstract class PartialViewMacroPage : UmbracoViewPage - { } -} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index ad7dd86730..e59eed272c 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -204,7 +204,6 @@ -