NetCore: Migrate more tests (#9494)

* Migrate tests

* Cleanup

* Migrate tests

* post merge fix

Signed-off-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
Bjarke Berg
2020-12-08 09:19:51 +01:00
committed by GitHub
parent b8696364ef
commit 40a6fa2b89
30 changed files with 227 additions and 2837 deletions

View File

@@ -21,12 +21,15 @@
</ItemGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Tests</_Parameter1>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Tests</_Parameter1>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Tests.UnitTests</_Parameter1>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Tests.Integration</_Parameter1>
</AssemblyAttribute>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Tests.Benchmarks</_Parameter1>
</AssemblyAttribute>

View File

@@ -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
/// </remarks>
public TestDatabase(DatabaseType databaseType = null, ISqlSyntaxProvider syntaxProvider = null)
{
DatabaseType = databaseType ?? new SqlServerCEDatabaseType();
SqlContext = new SqlContext(syntaxProvider ?? new SqlCeSyntaxProvider(), DatabaseType, Mock.Of<IPocoDataFactory>());
DatabaseType = databaseType ?? new SqlServerDatabaseType();
SqlContext = new SqlContext(syntaxProvider ?? new SqlServerSyntaxProvider(), DatabaseType, Mock.Of<IPocoDataFactory>());
}
/// <summary>

View File

@@ -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<IUmbracoVersion>();
[Test]
public void CreateTableOfTDto()
{

View File

@@ -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<IRedirectUrlService>();
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<ILogger<RedirectUrlRepository>>());
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);
}
}
}

View File

@@ -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<AuditItem, object>(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<AuditItem, object>(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<AuditItem, object>(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<AuditItem, object>(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);
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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<IConfiguration>(), TestHelper.GetMockedTypeLoader());
@@ -38,37 +35,41 @@ namespace Umbraco.Tests.Published
.Append<SimpleConverter3A>()
.Append<SimpleConverter3B>();
IPublishedModelFactory factory = new PublishedModelFactory(new[]
{
typeof (PublishedSnapshotTestObjects.TestElementModel1), typeof (PublishedSnapshotTestObjects.TestElementModel2),
typeof (PublishedSnapshotTestObjects.TestContentModel1), typeof (PublishedSnapshotTestObjects.TestContentModel2),
}, Mock.Of<IPublishedValueFallback>());
IPublishedModelFactory factory = new PublishedModelFactory(
new[]
{
typeof(PublishedSnapshotTestObjects.TestElementModel1),
typeof(PublishedSnapshotTestObjects.TestElementModel2),
typeof(PublishedSnapshotTestObjects.TestContentModel1),
typeof(PublishedSnapshotTestObjects.TestContentModel2)
}, Mock.Of<IPublishedValueFallback>());
register.AddTransient(f => factory);
var cacheMock = new Mock<IPublishedContentCache>();
var cacheContent = new Dictionary<int, IPublishedContent>();
cacheMock.Setup(x => x.GetById(It.IsAny<int>())).Returns<int>(id => cacheContent.TryGetValue(id, out IPublishedContent content) ? content : null);
cacheMock.Setup(x => x.GetById(It.IsAny<int>())).Returns<int>(id =>
cacheContent.TryGetValue(id, out IPublishedContent content) ? content : null);
var publishedSnapshotMock = new Mock<IPublishedSnapshot>();
publishedSnapshotMock.Setup(x => x.Content).Returns(cacheMock.Object);
var publishedSnapshotAccessorMock = new Mock<IPublishedSnapshotAccessor>();
publishedSnapshotAccessorMock.Setup(x => x.PublishedSnapshot).Returns(publishedSnapshotMock.Object);
register.AddTransient(f => publishedSnapshotAccessorMock.Object);
var registerFactory = composition.CreateServiceProvider();
var converters = registerFactory.GetRequiredService<PropertyValueConverterCollection>();
IServiceProvider registerFactory = composition.CreateServiceProvider();
PropertyValueConverterCollection converters =
registerFactory.GetRequiredService<PropertyValueConverterCollection>();
var serializer = new ConfigurationEditorJsonSerializer();
var dataTypeServiceMock = new Mock<IDataTypeService>();
var dataType1 = new DataType(new VoidEditor(NullLoggerFactory.Instance, dataTypeServiceMock.Object,
Mock.Of<ILocalizationService>(), Mock.Of<ILocalizedTextService>(), Mock.Of<IShortStringHelper>()), serializer)
{ Id = 1 };
Mock.Of<ILocalizationService>(), Mock.Of<ILocalizedTextService>(), Mock.Of<IShortStringHelper>()),
serializer) { Id = 1 };
var dataType2 = new DataType(new VoidEditor("2", NullLoggerFactory.Instance, Mock.Of<IDataTypeService>(),
Mock.Of<ILocalizationService>(), Mock.Of<ILocalizedTextService>(), Mock.Of<IShortStringHelper>()), serializer)
{ Id = 2 };
Mock.Of<ILocalizationService>(), Mock.Of<ILocalizedTextService>(), Mock.Of<IShortStringHelper>()),
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<string, object> { { "prop1", "val1" } }, false);
var element2 = new PublishedElement(elementType2, Guid.NewGuid(), new Dictionary<string, object> { { "prop2", "1003" } }, false);
var element1 = new PublishedElement(elementType1, Guid.NewGuid(),
new Dictionary<string, object> { { "prop1", "val1" } }, false);
var element2 = new PublishedElement(elementType2, Guid.NewGuid(),
new Dictionary<string, object> { { "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>();
IPublishedModelFactory publishedModelFactory = registerFactory.GetRequiredService<IPublishedModelFactory>();
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<PublishedSnapshotTestObjects.TestContentModel1>), contentType2.GetPropertyType("prop2").ClrType);
Assert.IsTrue(ModelType.Equals(typeof(IEnumerable<>).MakeGenericType(ModelType.For("content1")),
contentType2.GetPropertyType("prop2").ModelClrType));
Assert.AreEqual(typeof(IEnumerable<PublishedSnapshotTestObjects.TestContentModel1>),
contentType2.GetPropertyType("prop2").ClrType);
// can create a model for an element
var model1 = factory.CreateModel(element1);
IPublishedElement model1 = factory.CreateModel(element1);
Assert.IsInstanceOf<PublishedSnapshotTestObjects.TestElementModel1>(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<PublishedSnapshotTestObjects.TestElementModel2>(model2);
var mmodel2 = (PublishedSnapshotTestObjects.TestElementModel2)model2;
// and get direct property
Assert.IsInstanceOf<PublishedSnapshotTestObjects.TestContentModel1[]>(model2.Value(Mock.Of<IPublishedValueFallback>(), "prop2"));
Assert.AreEqual(1, ((PublishedSnapshotTestObjects.TestContentModel1[])model2.Value(Mock.Of<IPublishedValueFallback>(), "prop2")).Length);
Assert.IsInstanceOf<PublishedSnapshotTestObjects.TestContentModel1[]>(
model2.Value(Mock.Of<IPublishedValueFallback>(), "prop2"));
Assert.AreEqual(1,
((PublishedSnapshotTestObjects.TestContentModel1[])model2.Value(Mock.Of<IPublishedValueFallback>(),
"prop2")).Length);
// and get model property
Assert.IsInstanceOf<IEnumerable<PublishedSnapshotTestObjects.TestContentModel1>>(mmodel2.Prop2);
Assert.IsInstanceOf<PublishedSnapshotTestObjects.TestContentModel1[]>(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<int>();
}
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
}
}

View File

@@ -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<MigrationContext> _logger;
private ISqlSyntaxProvider _sqlSyntax;
private IUmbracoDatabase _database;
private readonly ILogger<MigrationContext> _logger = Mock.Of<ILogger<MigrationContext>>();
[SetUp]
public void Setup()
{
_logger = Mock.Of<ILogger<MigrationContext>>();
_sqlSyntax = new SqlCeSyntaxProvider();
var dbProviderFactory = DbProviderFactories.GetFactory(Constants.DbProviderNames.SqlServer);
var sqlContext = new SqlContext(_sqlSyntax, DatabaseType.SqlServer2008, Mock.Of<IPocoDataFactory>());
_database = new UmbracoDatabase("cstr", sqlContext, dbProviderFactory, Mock.Of<ILogger<UmbracoDatabase>>(), 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());
}

View File

@@ -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>();
IScope scope = Mock.Of<IScope>();
Mock.Get(scope)
.Setup(x => x.Database)
.Returns(database);
var sqlContext = new SqlContext(new SqlCeSyntaxProvider(), DatabaseType.SQLCe, Mock.Of<IPocoDataFactory>());
var sqlContext = new SqlContext(new SqlServerSyntaxProvider(), DatabaseType.SQLCe,
Mock.Of<IPocoDataFactory>());
var scopeProvider = new MigrationTests.TestScopeProvider(scope) { SqlContext = sqlContext };
var migrationBuilder = Mock.Of<IMigrationBuilder>();
IMigrationBuilder migrationBuilder = Mock.Of<IMigrationBuilder>();
Mock.Get(migrationBuilder)
.Setup(x => x.Build(It.IsAny<Type>(), It.IsAny<IMigrationContext>()))
.Returns<Type, IMigrationContext>((t, c) =>
@@ -52,22 +52,24 @@ namespace Umbraco.Tests.Migrations
}
});
var plan = new MigrationPlan("default")
MigrationPlan plan = new MigrationPlan("default")
.From(string.Empty)
.To<DeleteRedirectUrlTable>("{4A9A1A8F-0DA1-4BCF-AD06-C19D79152E35}")
.To<NoopMigration>("VERSION.33");
var kvs = Mock.Of<IKeyValueService>();
Mock.Get(kvs).Setup(x => x.GetValue(It.IsAny<string>())).Returns<string>(k => k == "Umbraco.Tests.MigrationPlan" ? string.Empty : null);
IKeyValueService kvs = Mock.Of<IKeyValueService>();
Mock.Get(kvs).Setup(x => x.GetValue(It.IsAny<string>()))
.Returns<string>(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<MigrationPlan>(), loggerFactory);
state = plan.Execute(s, sourceState, migrationBuilder, loggerFactory.CreateLogger<MigrationPlan>(),
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();
}
}
}

View File

@@ -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<IUmbracoDatabase>(), Mock.Of<ILogger<MigrationContext>>());
var migrationContext =
new MigrationContext(Mock.Of<IUmbracoDatabase>(), Mock.Of<ILogger<MigrationContext>>());
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<IUmbracoDatabase>(), Mock.Of<ILogger<MigrationContext>>());
var migrationContext =
new MigrationContext(Mock.Of<IUmbracoDatabase>(), Mock.Of<ILogger<MigrationContext>>());
IMigration migration = new BadMigration1(migrationContext);
Assert.Throws<IncompleteMigrationExpressionException>(() => migration.Migrate());
}
@@ -79,7 +72,8 @@ namespace Umbraco.Tests.Migrations
[Test]
public void DetectBadMigration2()
{
var migrationContext = new MigrationContext(Mock.Of<IUmbracoDatabase>(), Mock.Of<ILogger<MigrationContext>>());
var migrationContext =
new MigrationContext(Mock.Of<IUmbracoDatabase>(), Mock.Of<ILogger<MigrationContext>>());
IMigration migration = new BadMigration2(migrationContext);
Assert.Throws<IncompleteMigrationExpressionException>(() => 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()
{

View File

@@ -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>();
IMigrationBuilder builder = Mock.Of<IMigrationBuilder>();
Mock.Get(builder)
.Setup(x => x.Build(It.IsAny<Type>(), It.IsAny<IMigrationContext>()))
.Returns<Type, IMigrationContext>((t, c) =>
@@ -39,22 +39,30 @@ namespace Umbraco.Tests.Migrations
});
var database = new TestDatabase();
var scope = Mock.Of<IScope>();
IScope scope = Mock.Of<IScope>();
Mock.Get(scope)
.Setup(x => x.Database)
.Returns(database);
var sqlContext = new SqlContext(new SqlCeSyntaxProvider(), DatabaseType.SQLCe, Mock.Of<IPocoDataFactory>());
var sqlContext = new SqlContext(
new SqlServerSyntaxProvider(),
DatabaseType.SQLCe,
Mock.Of<IPocoDataFactory>());
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>();
TestPostMigration.MigrateCount = 0;
var upgrader = new Upgrader(plan);
upgrader.Execute(scopeProvider, builder, Mock.Of<IKeyValueService>(), _loggerFactory.CreateLogger<Upgrader>(), _loggerFactory);
upgrader.Execute(
scopeProvider,
builder,
Mock.Of<IKeyValueService>(),
s_loggerFactory.CreateLogger<Upgrader>(),
s_loggerFactory);
Assert.AreEqual(1, TestPostMigration.MigrateCount);
}
@@ -62,7 +70,7 @@ namespace Umbraco.Tests.Migrations
[Test]
public void MigrationCanAddPostMigration()
{
var builder = Mock.Of<IMigrationBuilder>();
IMigrationBuilder builder = Mock.Of<IMigrationBuilder>();
Mock.Get(builder)
.Setup(x => x.Build(It.IsAny<Type>(), It.IsAny<IMigrationContext>()))
.Returns<Type, IMigrationContext>((t, c) =>
@@ -81,24 +89,32 @@ namespace Umbraco.Tests.Migrations
});
var database = new TestDatabase();
var scope = Mock.Of<IScope>();
IScope scope = Mock.Of<IScope>();
Mock.Get(scope)
.Setup(x => x.Database)
.Returns(database);
var sqlContext = new SqlContext(new SqlCeSyntaxProvider(), DatabaseType.SQLCe, Mock.Of<IPocoDataFactory>());
var sqlContext = new SqlContext(
new SqlServerSyntaxProvider(),
DatabaseType.SQLCe,
Mock.Of<IPocoDataFactory>());
var scopeProvider = new MigrationTests.TestScopeProvider(scope) { SqlContext = sqlContext };
var plan = new MigrationPlan("Test")
MigrationPlan plan = new MigrationPlan("Test")
.From(string.Empty).To<TestMigration>("done");
TestMigration.MigrateCount = 0;
TestPostMigration.MigrateCount = 0;
new MigrationContext(database, _loggerFactory.CreateLogger<MigrationContext>());
new MigrationContext(database, s_loggerFactory.CreateLogger<MigrationContext>());
var upgrader = new Upgrader(plan);
upgrader.Execute(scopeProvider, builder, Mock.Of<IKeyValueService>(), _loggerFactory.CreateLogger<Upgrader>(), _loggerFactory);
upgrader.Execute(
scopeProvider,
builder,
Mock.Of<IKeyValueService>(),
s_loggerFactory.CreateLogger<Upgrader>(),
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++;
}
}
}

View File

@@ -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

View File

@@ -8,6 +8,7 @@
<ItemGroup>
<ProjectReference Include="..\Umbraco.ModelsBuilder.Embedded\Umbraco.ModelsBuilder.Embedded.csproj" />
<ProjectReference Include="..\Umbraco.PublishedCache.NuCache\Umbraco.PublishedCache.NuCache.csproj" />
<ProjectReference Include="..\Umbraco.Tests.Common\Umbraco.Tests.Common.csproj" />
<ProjectReference Include="..\Umbraco.Web.BackOffice\Umbraco.Web.BackOffice.csproj" />
<ProjectReference Include="..\Umbraco.Web.Common\Umbraco.Web.Common.csproj" />

View File

@@ -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)

View File

@@ -1,143 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Umbraco.Tests.Migrations.SqlScripts {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// 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() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[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;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// 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]&quot;;.
/// </summary>
internal static string SqlCe_SchemaAndData_4110 {
get {
return ResourceManager.GetString("SqlCe_SchemaAndData_4110", resourceCulture);
}
}
/// <summary>
/// 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]&quot;;.
/// </summary>
internal static string SqlCeTotal_480 {
get {
return ResourceManager.GetString("SqlCeTotal_480", resourceCulture);
}
}
/// <summary>
/// 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]&quot;;.
/// </summary>
internal static string SqlServerTotal_480 {
get {
return ResourceManager.GetString("SqlServerTotal_480", resourceCulture);
}
}
}
}

View File

@@ -1,130 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="SqlCeTotal_480" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>sqlcetotal-480.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="SqlCe_SchemaAndData_4110" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>sqlce-schemaanddata-4110.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
</data>
<data name="SqlServerTotal_480" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>sqlservertotal-480.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
</root>

File diff suppressed because it is too large Load Diff

View File

@@ -129,16 +129,11 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Cache\DistributedCacheBinderTests.cs" />
<Compile Include="Cache\RefresherTests.cs" />
<Compile Include="Cache\SnapDictionaryTests.cs" />
<Compile Include="IO\ShadowFileSystemTests.cs" />
<Compile Include="LegacyXmlPublishedCache\ContentXmlDto.cs" />
<Compile Include="LegacyXmlPublishedCache\PreviewXmlDto.cs" />
<Compile Include="Migrations\MigrationPlanTests.cs" />
<Compile Include="Migrations\MigrationTests.cs" />
<Compile Include="Models\ContentXmlTest.cs" />
<Compile Include="PublishedContent\SolidPublishedSnapshot.cs" />
<Compile Include="Published\ConvertersTests.cs" />
<Compile Include="Published\ModelTypeTests.cs" />
<Compile Include="Routing\BaseUrlProviderTest.cs" />
<Compile Include="Routing\UrlProviderWithHideTopLevelNodeFromPathTests.cs" />
@@ -160,12 +155,10 @@
<Compile Include="Routing\MediaUrlProviderTests.cs" />
<Compile Include="Routing\RoutableDocumentFilterTests.cs" />
<Compile Include="Routing\GetContentUrlsTests.cs" />
<Compile Include="Services\RedirectUrlServiceTests.cs" />
<Compile Include="TestHelpers\RandomIdRamDirectory.cs" />
<Compile Include="TestHelpers\Stubs\TestUserPasswordConfig.cs" />
<Compile Include="Testing\Objects\TestDataSource.cs" />
<Compile Include="Issues\U9560.cs" />
<Compile Include="Migrations\AdvancedMigrationTests.cs" />
<Compile Include="Routing\ContentFinderByUrlAndTemplateTests.cs" />
<Compile Include="Routing\ContentFinderByUrlTests.cs" />
<Compile Include="Routing\ContentFinderByUrlWithDomainsTests.cs" />
@@ -186,14 +179,13 @@
<Compile Include="TestHelpers\ControllerTesting\TraceExceptionLogger.cs" />
<Compile Include="Testing\Objects\Accessors\NoHttpContextAccessor.cs" />
<Compile Include="TestHelpers\Stubs\TestExamineManager.cs" />
<Compile Include="Testing\TestDatabase.cs" />
<Compile Include="Testing\TestingTests\NUnitTests.cs" />
<Compile Include="Persistence\LocksTests.cs" />
<Compile Include="Migrations\PostMigrationTests.cs" />
<Compile Include="Testing\UmbracoTestBase.cs" />
<Compile Include="TestHelpers\TestObjects-Mocks.cs" />
<Compile Include="TestHelpers\TestObjects.cs" />
<Compile Include="UmbracoExamine\RandomIdRamDirectory.cs" />
<Compile Include="Web\AngularIntegration\AngularAntiForgeryTests.cs" />
<Compile Include="Migrations\Stubs\DropForeignKeyMigrationStub.cs" />
<Compile Include="Cache\DefaultCachePolicyTests.cs" />
<Compile Include="Cache\FullDataSetCachePolicyTests.cs" />
@@ -204,9 +196,6 @@
<Compile Include="Routing\RoutesCacheTests.cs" />
<Compile Include="Routing\UrlRoutingTestBase.cs" />
<Compile Include="Web\PublishedContentQueryTests.cs" />
<Compile Include="Migrations\Stubs\FiveZeroMigration.cs" />
<Compile Include="Migrations\Stubs\FourElevenMigration.cs" />
<Compile Include="Migrations\Stubs\SixZeroMigration2.cs" />
<Compile Include="Testing\TestingTests\MockTests.cs" />
<Compile Include="Web\Mvc\SurfaceControllerTests.cs" />
<Compile Include="Web\Mvc\MergeParentContextViewDataAttributeTests.cs" />
@@ -218,15 +207,6 @@
<Compile Include="Scheduling\BackgroundTaskRunnerTests.cs" />
<Compile Include="Packaging\PackageInstallationTest.cs" />
<Compile Include="Cache\PublishedCache\PublishedMediaCacheTests.cs" />
<Compile Include="Migrations\AlterMigrationTests.cs" />
<Compile Include="Migrations\SqlScripts\SqlResources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>SqlResources.resx</DependentUpon>
</Compile>
<Compile Include="Migrations\Stubs\AlterUserTableMigrationStub.cs" />
<Compile Include="Migrations\Stubs\Dummy.cs" />
<Compile Include="Migrations\Stubs\SixZeroMigration1.cs" />
<Compile Include="Models\MediaXmlTest.cs" />
<Compile Include="Persistence\FaultHandling\ConnectionRetryTest.cs" />
<Compile Include="Persistence\SchemaValidationTest.cs" />
@@ -336,11 +316,6 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Migrations\SqlScripts\SqlResources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>SqlResources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Services\Importing\ImportResources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>ImportResources.Designer.cs</LastGenOutput>
@@ -353,10 +328,6 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="Migrations\SqlScripts\MySqlTotal-480.sql" />
<Content Include="Migrations\SqlScripts\SqlCe-SchemaAndData-4110.sql" />
<Content Include="Migrations\SqlScripts\SqlCeTotal-480.sql" />
<Content Include="Migrations\SqlScripts\SqlServerTotal-480.sql" />
<Content Include="Services\Importing\CheckboxList-Content-Package.xml">
<SubType>Designer</SubType>
</Content>

View File

@@ -1,11 +0,0 @@
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;
namespace Umbraco.Web.Macros
{
/// <summary>
/// The base view class that PartialViewMacro views need to inherit from
/// </summary>
public abstract class PartialViewMacroPage : UmbracoViewPage<PartialViewMacroModel>
{ }
}

View File

@@ -204,6 +204,7 @@
<Compile Include="Security\Providers\MembersRoleProvider.cs" />
<Compile Include="Security\Providers\UmbracoMembershipProvider.cs" />
<Compile Include="HttpRequestExtensions.cs" />
<Compile Include="HttpUrlHelperExtensions.cs" />
<Compile Include="Macros\PartialViewMacroPage.cs" />
<Compile Include="Mvc\AreaRegistrationExtensions.cs" />
<Compile Include="Mvc\QueryStringFilterAttribute.cs" />