More unit tests.
More db constraints. Removed unnused db tables from installer script. Added constraints to installer script for MSSQL. [TFS Changeset #68480]
This commit is contained in:
259
umbraco.Test/MemberGroupTest.cs
Normal file
259
umbraco.Test/MemberGroupTest.cs
Normal file
@@ -0,0 +1,259 @@
|
||||
using umbraco.cms.businesslogic.member;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using umbraco.BusinessLogic;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
|
||||
namespace umbraco.Test
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
///This is a test class for MemberGroupTest and is intended
|
||||
///to contain all MemberGroupTest Unit Tests
|
||||
///</summary>
|
||||
[TestClass()]
|
||||
public class MemberGroupTest
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Make a new member group and delete it
|
||||
///</summary>
|
||||
[TestMethod()]
|
||||
public void MemberGroup_Make_New()
|
||||
{
|
||||
var m = MemberGroup.MakeNew(Guid.NewGuid().ToString("N"), m_User);
|
||||
Assert.IsTrue(m.Id > 0);
|
||||
Assert.IsInstanceOfType(m, typeof(MemberGroup));
|
||||
|
||||
m.delete();
|
||||
//make sure its gone
|
||||
Assert.IsFalse(MemberGroup.IsNode(m.Id));
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new member group, put a member in it, then delete the group and ensure the member is gone
|
||||
/// </summary>
|
||||
[TestMethod()]
|
||||
public void MemberGroup_Add_Member_To_Group_And_Delete_Group()
|
||||
{
|
||||
var mt = MemberType.MakeNew(m_User, "TEST" + Guid.NewGuid().ToString("N"));
|
||||
var m = Member.MakeNew("TEST" + Guid.NewGuid().ToString("N"),
|
||||
"TEST" + Guid.NewGuid().ToString("N") + "@test.com", mt, m_User);
|
||||
|
||||
var mg = MemberGroup.MakeNew("TEST" + Guid.NewGuid().ToString("N"), m_User);
|
||||
Assert.IsInstanceOfType(mg, typeof(MemberGroup));
|
||||
Assert.IsTrue(mg.Id > 0);
|
||||
|
||||
//add the member to the group
|
||||
m.AddGroup(mg.Id);
|
||||
|
||||
//ensure they are added
|
||||
Assert.AreEqual(1, m.Groups.Count);
|
||||
Assert.AreEqual<int>(mg.Id, ((MemberGroup)m.Groups.Cast<DictionaryEntry>().First().Value).Id);
|
||||
|
||||
//delete the group
|
||||
mg.delete();
|
||||
|
||||
//make sure the member is no longer associated
|
||||
m = new Member(m.Id); //need to re-get the member
|
||||
Assert.AreEqual<int>(0, m.Groups.Count);
|
||||
|
||||
//now cleanup...
|
||||
|
||||
m.delete();
|
||||
Assert.IsFalse(Member.IsNode(m.Id));
|
||||
|
||||
mt.delete();
|
||||
Assert.IsFalse(MemberType.IsNode(mt.Id));
|
||||
}
|
||||
|
||||
private User m_User = new User(0);
|
||||
|
||||
#region Tests to write
|
||||
|
||||
///// <summary>
|
||||
/////A test for MemberGroup Constructor
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void MemberGroupConstructorTest()
|
||||
//{
|
||||
// Guid id = new Guid(); // TODO: Initialize to an appropriate value
|
||||
// MemberGroup target = new MemberGroup(id);
|
||||
// Assert.Inconclusive("TODO: Implement code to verify target");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for MemberGroup Constructor
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void MemberGroupConstructorTest1()
|
||||
//{
|
||||
// int id = 0; // TODO: Initialize to an appropriate value
|
||||
// MemberGroup target = new MemberGroup(id);
|
||||
// Assert.Inconclusive("TODO: Implement code to verify target");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for GetByName
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void GetByNameTest()
|
||||
//{
|
||||
// string Name = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// MemberGroup expected = null; // TODO: Initialize to an appropriate value
|
||||
// MemberGroup actual;
|
||||
// actual = MemberGroup.GetByName(Name);
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for GetMembers
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void GetMembersTest()
|
||||
//{
|
||||
// Guid id = new Guid(); // TODO: Initialize to an appropriate value
|
||||
// MemberGroup target = new MemberGroup(id); // TODO: Initialize to an appropriate value
|
||||
// Member[] expected = null; // TODO: Initialize to an appropriate value
|
||||
// Member[] actual;
|
||||
// actual = target.GetMembers();
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for GetMembers
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void GetMembersTest1()
|
||||
//{
|
||||
// Guid id = new Guid(); // TODO: Initialize to an appropriate value
|
||||
// MemberGroup target = new MemberGroup(id); // TODO: Initialize to an appropriate value
|
||||
// string usernameToMatch = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// Member[] expected = null; // TODO: Initialize to an appropriate value
|
||||
// Member[] actual;
|
||||
// actual = target.GetMembers(usernameToMatch);
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for GetMembersAsIds
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void GetMembersAsIdsTest()
|
||||
//{
|
||||
// Guid id = new Guid(); // TODO: Initialize to an appropriate value
|
||||
// MemberGroup target = new MemberGroup(id); // TODO: Initialize to an appropriate value
|
||||
// int[] expected = null; // TODO: Initialize to an appropriate value
|
||||
// int[] actual;
|
||||
// actual = target.GetMembersAsIds();
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for HasMember
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void HasMemberTest()
|
||||
//{
|
||||
// Guid id = new Guid(); // TODO: Initialize to an appropriate value
|
||||
// MemberGroup target = new MemberGroup(id); // TODO: Initialize to an appropriate value
|
||||
// int memberId = 0; // TODO: Initialize to an appropriate value
|
||||
// bool expected = false; // TODO: Initialize to an appropriate value
|
||||
// bool actual;
|
||||
// actual = target.HasMember(memberId);
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
///// <summary>
|
||||
/////A test for Save
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void SaveTest()
|
||||
//{
|
||||
// Guid id = new Guid(); // TODO: Initialize to an appropriate value
|
||||
// MemberGroup target = new MemberGroup(id); // TODO: Initialize to an appropriate value
|
||||
// target.Save();
|
||||
// Assert.Inconclusive("A method that does not return a value cannot be verified.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for delete
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void deleteTest()
|
||||
//{
|
||||
// Guid id = new Guid(); // TODO: Initialize to an appropriate value
|
||||
// MemberGroup target = new MemberGroup(id); // TODO: Initialize to an appropriate value
|
||||
// target.delete();
|
||||
// Assert.Inconclusive("A method that does not return a value cannot be verified.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for GetAll
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void GetAllTest()
|
||||
//{
|
||||
// MemberGroup[] actual;
|
||||
// actual = MemberGroup.GetAll;
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for Text
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void TextTest()
|
||||
//{
|
||||
// Guid id = new Guid(); // TODO: Initialize to an appropriate value
|
||||
// MemberGroup target = new MemberGroup(id); // TODO: Initialize to an appropriate value
|
||||
// string expected = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string actual;
|
||||
// target.Text = expected;
|
||||
// actual = target.Text;
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region Additional test attributes
|
||||
//
|
||||
//You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
//Use ClassInitialize to run code before running the first test in the class
|
||||
//[ClassInitialize()]
|
||||
//public static void MyClassInitialize(TestContext testContext)
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Use ClassCleanup to run code after all tests in a class have run
|
||||
//[ClassCleanup()]
|
||||
//public static void MyClassCleanup()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Use TestInitialize to run code before running each test
|
||||
//[TestInitialize()]
|
||||
//public void MyTestInitialize()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Use TestCleanup to run code after each test has run
|
||||
//[TestCleanup()]
|
||||
//public void MyTestCleanup()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ namespace umbraco.Test
|
||||
Assert.AreEqual(1, m.Groups.Count);
|
||||
Assert.AreEqual<int>(mg.Id, ((MemberGroup)m.Groups.Cast<DictionaryEntry>().First().Value).Id);
|
||||
|
||||
//remove the grup
|
||||
//remove the grup association
|
||||
m.RemoveGroup(mg.Id);
|
||||
|
||||
//ensure they are removed
|
||||
|
||||
612
umbraco.Test/UmbracoMembershipProviderTest.cs
Normal file
612
umbraco.Test/UmbracoMembershipProviderTest.cs
Normal file
@@ -0,0 +1,612 @@
|
||||
using umbraco.providers.members;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Web.Security;
|
||||
using System.Collections.Specialized;
|
||||
using umbraco.cms.businesslogic.member;
|
||||
using umbraco.BusinessLogic;
|
||||
using System.Linq;
|
||||
|
||||
namespace umbraco.Test
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
///This is a test class for UmbracoMembershipProviderTest and is intended
|
||||
///to contain all UmbracoMembershipProviderTest Unit Tests
|
||||
///</summary>
|
||||
[TestClass()]
|
||||
public class UmbracoMembershipProviderTest
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create a new member with the provider, then re-get them with the provider and make sure they are the same
|
||||
///</summary>
|
||||
[TestMethod()]
|
||||
public void MembershipProvider_Create_User()
|
||||
{
|
||||
|
||||
string username = Guid.NewGuid().ToString("N");
|
||||
string password = Guid.NewGuid().ToString("N");
|
||||
string email = Guid.NewGuid().ToString("N") + "@email.com";
|
||||
string passwordQuestion = Guid.NewGuid().ToString("N");
|
||||
string passwordAnswer = Guid.NewGuid().ToString("N");
|
||||
bool isApproved = true;
|
||||
|
||||
MembershipCreateStatus status = new MembershipCreateStatus(); // TODO: Initialize to an appropriate value
|
||||
|
||||
var m = m_Provider.CreateUser(username, password, email, passwordQuestion, passwordAnswer, isApproved, null, out status);
|
||||
|
||||
Assert.AreEqual<MembershipCreateStatus>(MembershipCreateStatus.Success, status);
|
||||
Assert.AreEqual<string>(email, m.Email);
|
||||
|
||||
var m1 = m_Provider.GetUser(m.ProviderUserKey, false);
|
||||
Assert.AreEqual<string>(m.UserName, m1.UserName);
|
||||
|
||||
//delete the member
|
||||
m_Provider.DeleteUser(username, true);
|
||||
|
||||
//make sure its gone
|
||||
var hasException = false;
|
||||
try
|
||||
{
|
||||
m_Provider.GetUser(m.ProviderUserKey, false);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
hasException = true;
|
||||
}
|
||||
Assert.IsTrue(hasException);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new member and role and assign the member to the role, then cleanup
|
||||
/// </summary>
|
||||
[TestMethod()]
|
||||
public void MembershipProvider_Create_User_Assign_New_Role()
|
||||
{
|
||||
|
||||
string username = Guid.NewGuid().ToString("N");
|
||||
string password = Guid.NewGuid().ToString("N");
|
||||
string email = Guid.NewGuid().ToString("N") + "@email.com";
|
||||
string passwordQuestion = Guid.NewGuid().ToString("N");
|
||||
string passwordAnswer = Guid.NewGuid().ToString("N");
|
||||
bool isApproved = true;
|
||||
|
||||
MembershipCreateStatus status = new MembershipCreateStatus(); // TODO: Initialize to an appropriate value
|
||||
|
||||
var m = m_Provider.CreateUser(username, password, email, passwordQuestion, passwordAnswer, isApproved, null, out status);
|
||||
|
||||
Assert.AreEqual<MembershipCreateStatus>(MembershipCreateStatus.Success, status);
|
||||
Assert.AreEqual<string>(email, m.Email);
|
||||
|
||||
var m1 = m_Provider.GetUser(m.ProviderUserKey, false);
|
||||
Assert.AreEqual<string>(m.UserName, m1.UserName);
|
||||
|
||||
|
||||
//create role provider
|
||||
var roleProvider = new UmbracoRoleProvider();
|
||||
roleProvider.Initialize(string.Empty, new NameValueCollection());
|
||||
var newRole = Guid.NewGuid().ToString("N");
|
||||
roleProvider.CreateRole(newRole);
|
||||
//make sure it's there
|
||||
Assert.AreEqual<int>(1, roleProvider.GetAllRoles().Where(x => x == newRole).Count());
|
||||
|
||||
//add the user to the role
|
||||
roleProvider.AddUsersToRoles(new string[] { m.UserName }, new string[] { newRole });
|
||||
|
||||
//make sure they are in it
|
||||
Assert.IsTrue(roleProvider.IsUserInRole(m.UserName, newRole));
|
||||
|
||||
//delete the member
|
||||
m_Provider.DeleteUser(username, true);
|
||||
|
||||
//make sure its gone
|
||||
var hasException = false;
|
||||
try
|
||||
{
|
||||
m_Provider.GetUser(m.ProviderUserKey, false);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
hasException = true;
|
||||
}
|
||||
Assert.IsTrue(hasException);
|
||||
|
||||
//remove the role, this will throw an exception if the member is still assigned the role
|
||||
roleProvider.DeleteRole(newRole, true);
|
||||
}
|
||||
|
||||
|
||||
private UmbracoMembershipProvider m_Provider;
|
||||
private MemberType m_MemberType;
|
||||
|
||||
#region Tests to write
|
||||
|
||||
|
||||
///// <summary>
|
||||
/////A test for UmbracoMembershipProvider Constructor
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void UmbracoMembershipProviderConstructorTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider();
|
||||
// Assert.Inconclusive("TODO: Implement code to verify target");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for ChangePassword
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void ChangePasswordTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// string username = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string oldPassword = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string newPassword = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// bool expected = false; // TODO: Initialize to an appropriate value
|
||||
// bool actual;
|
||||
// actual = target.ChangePassword(username, oldPassword, newPassword);
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for ChangePasswordQuestionAndAnswer
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void ChangePasswordQuestionAndAnswerTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// string username = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string password = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string newPasswordQuestion = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string newPasswordAnswer = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// bool expected = false; // TODO: Initialize to an appropriate value
|
||||
// bool actual;
|
||||
// actual = target.ChangePasswordQuestionAndAnswer(username, password, newPasswordQuestion, newPasswordAnswer);
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
///// <summary>
|
||||
/////A test for DeleteUser
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void DeleteUserTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// string username = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// bool deleteAllRelatedData = false; // TODO: Initialize to an appropriate value
|
||||
// bool expected = false; // TODO: Initialize to an appropriate value
|
||||
// bool actual;
|
||||
// actual = target.DeleteUser(username, deleteAllRelatedData);
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for EncodePassword
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void EncodePasswordTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// string password = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string expected = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string actual;
|
||||
// actual = target.EncodePassword(password);
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for FindUsersByEmail
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void FindUsersByEmailTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// string emailToMatch = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// int pageIndex = 0; // TODO: Initialize to an appropriate value
|
||||
// int pageSize = 0; // TODO: Initialize to an appropriate value
|
||||
// int totalRecords = 0; // TODO: Initialize to an appropriate value
|
||||
// int totalRecordsExpected = 0; // TODO: Initialize to an appropriate value
|
||||
// MembershipUserCollection expected = null; // TODO: Initialize to an appropriate value
|
||||
// MembershipUserCollection actual;
|
||||
// actual = target.FindUsersByEmail(emailToMatch, pageIndex, pageSize, out totalRecords);
|
||||
// Assert.AreEqual(totalRecordsExpected, totalRecords);
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for FindUsersByName
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void FindUsersByNameTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// string usernameToMatch = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// int pageIndex = 0; // TODO: Initialize to an appropriate value
|
||||
// int pageSize = 0; // TODO: Initialize to an appropriate value
|
||||
// int totalRecords = 0; // TODO: Initialize to an appropriate value
|
||||
// int totalRecordsExpected = 0; // TODO: Initialize to an appropriate value
|
||||
// MembershipUserCollection expected = null; // TODO: Initialize to an appropriate value
|
||||
// MembershipUserCollection actual;
|
||||
// actual = target.FindUsersByName(usernameToMatch, pageIndex, pageSize, out totalRecords);
|
||||
// Assert.AreEqual(totalRecordsExpected, totalRecords);
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for GetAllUsers
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void GetAllUsersTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// int pageIndex = 0; // TODO: Initialize to an appropriate value
|
||||
// int pageSize = 0; // TODO: Initialize to an appropriate value
|
||||
// int totalRecords = 0; // TODO: Initialize to an appropriate value
|
||||
// int totalRecordsExpected = 0; // TODO: Initialize to an appropriate value
|
||||
// MembershipUserCollection expected = null; // TODO: Initialize to an appropriate value
|
||||
// MembershipUserCollection actual;
|
||||
// actual = target.GetAllUsers(pageIndex, pageSize, out totalRecords);
|
||||
// Assert.AreEqual(totalRecordsExpected, totalRecords);
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for GetNumberOfUsersOnline
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void GetNumberOfUsersOnlineTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// int expected = 0; // TODO: Initialize to an appropriate value
|
||||
// int actual;
|
||||
// actual = target.GetNumberOfUsersOnline();
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for GetPassword
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void GetPasswordTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// string username = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string answer = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string expected = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string actual;
|
||||
// actual = target.GetPassword(username, answer);
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for GetUser
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void GetUserTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// string username = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// bool userIsOnline = false; // TODO: Initialize to an appropriate value
|
||||
// MembershipUser expected = null; // TODO: Initialize to an appropriate value
|
||||
// MembershipUser actual;
|
||||
// actual = target.GetUser(username, userIsOnline);
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for GetUser
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void GetUserTest1()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// object providerUserKey = null; // TODO: Initialize to an appropriate value
|
||||
// bool userIsOnline = false; // TODO: Initialize to an appropriate value
|
||||
// MembershipUser expected = null; // TODO: Initialize to an appropriate value
|
||||
// MembershipUser actual;
|
||||
// actual = target.GetUser(providerUserKey, userIsOnline);
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for GetUserNameByEmail
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void GetUserNameByEmailTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// string email = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string expected = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string actual;
|
||||
// actual = target.GetUserNameByEmail(email);
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for Initialize
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void InitializeTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// string name = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// NameValueCollection config = null; // TODO: Initialize to an appropriate value
|
||||
// target.Initialize(name, config);
|
||||
// Assert.Inconclusive("A method that does not return a value cannot be verified.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for ResetPassword
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void ResetPasswordTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// string username = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string answer = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string expected = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string actual;
|
||||
// actual = target.ResetPassword(username, answer);
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for UnEncodePassword
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void UnEncodePasswordTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// string encodedPassword = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string expected = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string actual;
|
||||
// actual = target.UnEncodePassword(encodedPassword);
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for UnlockUser
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void UnlockUserTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// string userName = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// bool expected = false; // TODO: Initialize to an appropriate value
|
||||
// bool actual;
|
||||
// actual = target.UnlockUser(userName);
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for UpdateUser
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void UpdateUserTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// MembershipUser user = null; // TODO: Initialize to an appropriate value
|
||||
// target.UpdateUser(user);
|
||||
// Assert.Inconclusive("A method that does not return a value cannot be verified.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for ValidateUser
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void ValidateUserTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// string username = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string password = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// bool expected = false; // TODO: Initialize to an appropriate value
|
||||
// bool actual;
|
||||
// actual = target.ValidateUser(username, password);
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for ApplicationName
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void ApplicationNameTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// string expected = string.Empty; // TODO: Initialize to an appropriate value
|
||||
// string actual;
|
||||
// target.ApplicationName = expected;
|
||||
// actual = target.ApplicationName;
|
||||
// Assert.AreEqual(expected, actual);
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for EnablePasswordReset
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void EnablePasswordResetTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// bool actual;
|
||||
// actual = target.EnablePasswordReset;
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for EnablePasswordRetrieval
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void EnablePasswordRetrievalTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// bool actual;
|
||||
// actual = target.EnablePasswordRetrieval;
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for MaxInvalidPasswordAttempts
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void MaxInvalidPasswordAttemptsTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// int actual;
|
||||
// actual = target.MaxInvalidPasswordAttempts;
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for MinRequiredNonAlphanumericCharacters
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void MinRequiredNonAlphanumericCharactersTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// int actual;
|
||||
// actual = target.MinRequiredNonAlphanumericCharacters;
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for MinRequiredPasswordLength
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void MinRequiredPasswordLengthTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// int actual;
|
||||
// actual = target.MinRequiredPasswordLength;
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for PasswordAttemptWindow
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void PasswordAttemptWindowTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// int actual;
|
||||
// actual = target.PasswordAttemptWindow;
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for PasswordFormat
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void PasswordFormatTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// MembershipPasswordFormat actual;
|
||||
// actual = target.PasswordFormat;
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for PasswordStrengthRegularExpression
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void PasswordStrengthRegularExpressionTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// string actual;
|
||||
// actual = target.PasswordStrengthRegularExpression;
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for RequiresQuestionAndAnswer
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void RequiresQuestionAndAnswerTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// bool actual;
|
||||
// actual = target.RequiresQuestionAndAnswer;
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
/////A test for RequiresUniqueEmail
|
||||
/////</summary>
|
||||
//[TestMethod()]
|
||||
//public void RequiresUniqueEmailTest()
|
||||
//{
|
||||
// UmbracoMembershipProvider target = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
// bool actual;
|
||||
// actual = target.RequiresUniqueEmail;
|
||||
// Assert.Inconclusive("Verify the correctness of this test method.");
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region Additional test attributes
|
||||
//
|
||||
//You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
//Use ClassInitialize to run code before running the first test in the class
|
||||
//[ClassInitialize()]
|
||||
//public static void MyClassInitialize(TestContext testContext)
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Use ClassCleanup to run code after all tests in a class have run
|
||||
//[ClassCleanup()]
|
||||
//public static void MyClassCleanup()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
|
||||
[TestInitialize()]
|
||||
public void MyTestInitialize()
|
||||
{
|
||||
//need to create a member type for the provider
|
||||
m_MemberType = MemberType.MakeNew(User.GetUser(0), Guid.NewGuid().ToString("N"));
|
||||
|
||||
m_Provider = new UmbracoMembershipProvider(); // TODO: Initialize to an appropriate value
|
||||
|
||||
//initialize the provider
|
||||
var config = new NameValueCollection();
|
||||
config.Add("enablePasswordRetrieval", "false");
|
||||
config.Add("enablePasswordReset", "false");
|
||||
config.Add("requiresQuestionAndAnswer", "false");
|
||||
config.Add("defaultMemberTypeAlias", m_MemberType.Alias);
|
||||
config.Add("passwordFormat", "Hashed");
|
||||
|
||||
m_Provider.Initialize(string.Empty, config);
|
||||
|
||||
}
|
||||
|
||||
|
||||
[TestCleanup()]
|
||||
public void MyTestCleanup()
|
||||
{
|
||||
//remove the member type
|
||||
m_MemberType.delete();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -111,6 +111,7 @@
|
||||
<Reference Include="System.Web.Abstractions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.Extensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
@@ -148,6 +149,7 @@
|
||||
<Compile Include="MacroTest.cs" />
|
||||
<Compile Include="MediaTest.cs" />
|
||||
<Compile Include="MediaTypeTest.cs" />
|
||||
<Compile Include="MemberGroupTest.cs" />
|
||||
<Compile Include="MemberTest.cs" />
|
||||
<Compile Include="MemberTypeTest.cs" />
|
||||
<Compile Include="NotificationTest.cs" />
|
||||
@@ -160,6 +162,7 @@
|
||||
<Compile Include="TaskTest.cs" />
|
||||
<Compile Include="TaskTypeTest.cs" />
|
||||
<Compile Include="TemplateTest.cs" />
|
||||
<Compile Include="UmbracoMembershipProviderTest.cs" />
|
||||
<Compile Include="UserTest.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -450,6 +450,9 @@ namespace umbraco.cms.businesslogic
|
||||
// Delete all data associated with this content
|
||||
this.deleteAllProperties();
|
||||
|
||||
// Remove all content preview xml
|
||||
SqlHelper.ExecuteNonQuery("delete from cmsPreviewXml where nodeId = " + Id);
|
||||
|
||||
// Delete version history
|
||||
SqlHelper.ExecuteNonQuery("Delete from cmsContentVersion where ContentId = " + this.Id);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace umbraco.cms.businesslogic.member
|
||||
/// Deltes the current membergroup
|
||||
/// </summary>
|
||||
[Obsolete("Use System.Web.Security.Role.DeleteRole")]
|
||||
public new void delete()
|
||||
public override void delete()
|
||||
{
|
||||
DeleteEventArgs e = new DeleteEventArgs();
|
||||
FireBeforeDelete(e);
|
||||
|
||||
@@ -1610,10 +1610,7 @@ namespace umbraco.cms.businesslogic.web
|
||||
|
||||
// Remove all files
|
||||
DeleteAssociatedMediaFiles();
|
||||
|
||||
// Remove all content preview xml
|
||||
SqlHelper.ExecuteNonQuery("delete from cmsPreviewXml where nodeId = " + Id);
|
||||
|
||||
|
||||
//remove any domains associated
|
||||
var domains = Domain.GetDomainsById(this.Id).ToList();
|
||||
domains.ForEach(x => x.Delete());
|
||||
|
||||
@@ -81,15 +81,20 @@ userGroupName nvarchar (255) NOT NULL
|
||||
)
|
||||
|
||||
;
|
||||
|
||||
/* TABLE IS NEVER USED, REMOVED FOR 4.1
|
||||
|
||||
CREATE TABLE umbracoUser2userGroup
|
||||
(
|
||||
user int NOT NULL,
|
||||
userGroup smallint NOT NULL
|
||||
)
|
||||
|
||||
)
|
||||
;
|
||||
ALTER TABLE umbracoUser2userGroup ADD CONSTRAINT PK_user2userGroup PRIMARY KEY CLUSTERED (user, userGroup)
|
||||
;
|
||||
|
||||
*/
|
||||
|
||||
CREATE TABLE umbracoApp
|
||||
(
|
||||
sortOrder tinyint NOT NULL DEFAULT 0,
|
||||
@@ -143,8 +148,10 @@ macroPropertyTypeRenderAssembly nvarchar (255) NULL,
|
||||
macroPropertyTypeRenderType nvarchar (255) NULL,
|
||||
macroPropertyTypeBaseType nvarchar (255) NULL
|
||||
)
|
||||
|
||||
;
|
||||
|
||||
/* TABLE IS NEVER USED, REMOVED FOR 4.1
|
||||
|
||||
CREATE TABLE umbracoStylesheetProperty
|
||||
(
|
||||
id smallint NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
@@ -153,9 +160,11 @@ stylesheet tinyint NOT NULL,
|
||||
stylesheetPropertyAlias nvarchar (50) NULL,
|
||||
stylesheetPropertyName nvarchar (255) NULL,
|
||||
stylesheetPropertyValue nvarchar (400) NULL
|
||||
)
|
||||
|
||||
)
|
||||
;
|
||||
|
||||
*/
|
||||
|
||||
CREATE TABLE cmsTab
|
||||
(
|
||||
id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
@@ -436,16 +445,20 @@ childObjectType CHAR(36) NOT NULL,
|
||||
name nvarchar (255) NOT NULL,
|
||||
alias nvarchar (100) NULL
|
||||
)
|
||||
;
|
||||
|
||||
/* TABLE IS NEVER USED, REMOVED FOR 4.1
|
||||
|
||||
;
|
||||
CREATE TABLE umbracoStylesheet
|
||||
(
|
||||
nodeId int NOT NULL PRIMARY KEY,
|
||||
filename nvarchar (100) NOT NULL,
|
||||
content LONGTEXT NULL
|
||||
)
|
||||
|
||||
)
|
||||
;
|
||||
|
||||
*/
|
||||
|
||||
CREATE TABLE umbracoUser2NodeNotify
|
||||
(
|
||||
userId int NOT NULL,
|
||||
@@ -639,10 +652,16 @@ ALTER TABLE umbracoAppTree ADD FOREIGN KEY (appAlias) REFERENCES umbracoApp (app
|
||||
;
|
||||
ALTER TABLE cmsPropertyData ADD FOREIGN KEY (contentNodeId) REFERENCES umbracoNode (id)
|
||||
;
|
||||
|
||||
/* TABLE IS NEVER USED, REMOVED FOR 4.1
|
||||
|
||||
ALTER TABLE umbracoUser2userGroup ADD FOREIGN KEY (user) REFERENCES umbracoUser (id)
|
||||
;
|
||||
ALTER TABLE umbracoUser2userGroup ADD FOREIGN KEY (userGroup) REFERENCES umbracoUserGroup (id)
|
||||
;
|
||||
|
||||
*/
|
||||
|
||||
ALTER TABLE cmsDocument ADD FOREIGN KEY (nodeId) REFERENCES umbracoNode (id)
|
||||
;
|
||||
ALTER TABLE cmsMacroProperty ADD FOREIGN KEY (macroPropertyType) REFERENCES cmsMacroPropertyType (id)
|
||||
@@ -661,8 +680,14 @@ ALTER TABLE cmsContent ADD FOREIGN KEY (nodeId) REFERENCES umbracoNode (id)
|
||||
;
|
||||
ALTER TABLE umbracoUser2app ADD FOREIGN KEY (app) REFERENCES umbracoApp (appAlias)
|
||||
;
|
||||
|
||||
/* TABLE IS NEVER USED, REMOVED FOR 4.1
|
||||
|
||||
ALTER TABLE umbracoUser2userGroup ADD FOREIGN KEY (user) REFERENCES umbracoUser (id)
|
||||
;
|
||||
|
||||
*/
|
||||
|
||||
CREATE TABLE cmsTask
|
||||
(
|
||||
closed bit NOT NULL DEFAULT 0,
|
||||
|
||||
@@ -106,6 +106,10 @@ DELETE FROM cmsContentTypeAllowedContentType WHERE id NOT IN (SELECT nodeId FROM
|
||||
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)
|
||||
;
|
||||
|
||||
/************************** CLEANUP END ********************************************/
|
||||
|
||||
|
||||
@@ -607,4 +611,51 @@ ALTER TABLE dbo.cmsTemplate ADD CONSTRAINT
|
||||
nodeId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsContentVersion ADD CONSTRAINT
|
||||
IX_cmsContentVersion UNIQUE NONCLUSTERED
|
||||
(
|
||||
VersionId
|
||||
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsPreviewXml ADD CONSTRAINT
|
||||
FK_cmsPreviewXml_cmsContentVersion FOREIGN KEY
|
||||
(
|
||||
versionId
|
||||
) REFERENCES dbo.cmsContentVersion
|
||||
(
|
||||
VersionId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsPreviewXml ADD CONSTRAINT
|
||||
FK_cmsPreviewXml_cmsContent FOREIGN KEY
|
||||
(
|
||||
nodeId
|
||||
) REFERENCES dbo.cmsContent
|
||||
(
|
||||
nodeId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsMemberType ADD CONSTRAINT
|
||||
IX_cmsMemberType UNIQUE NONCLUSTERED
|
||||
(
|
||||
NodeId
|
||||
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsMember2MemberGroup ADD CONSTRAINT
|
||||
FK_cmsMember2MemberGroup_umbracoNode FOREIGN KEY
|
||||
(
|
||||
MemberGroup
|
||||
) REFERENCES dbo.umbracoNode
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
@@ -80,12 +80,14 @@ CREATE TABLE [umbracoLog]
|
||||
;
|
||||
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])
|
||||
;
|
||||
@@ -93,11 +95,13 @@ 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),
|
||||
@@ -166,6 +170,9 @@ CREATE TABLE [cmsMacroPropertyType]
|
||||
;
|
||||
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),
|
||||
@@ -175,10 +182,13 @@ CREATE TABLE [umbracoStylesheetProperty]
|
||||
[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),
|
||||
@@ -496,17 +506,22 @@ CREATE TABLE [umbracoRelationType]
|
||||
;
|
||||
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,
|
||||
@@ -541,10 +556,16 @@ CONSTRAINT [FK_umbracoAppTree_umbracoApp] FOREIGN KEY ([appAlias]) REFERENCES [u
|
||||
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])
|
||||
;
|
||||
@@ -590,10 +611,16 @@ 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]
|
||||
@@ -772,8 +799,14 @@ ALTER TABLE [umbracoAppTree] ADD CONSTRAINT [FK_umbracoAppTree_umbracoApp] FOREI
|
||||
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])
|
||||
@@ -970,4 +1003,676 @@ CREATE TABLE [dbo].[cmsPreviewXml](
|
||||
[versionId] ASC
|
||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
||||
;
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************************************************************************
|
||||
|
||||
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)
|
||||
;
|
||||
|
||||
/************************** CLEANUP END ********************************************/
|
||||
|
||||
|
||||
/* Create missing indexes and primary keys */
|
||||
CREATE NONCLUSTERED INDEX [IX_Icon] ON CMSContenttype(nodeId, Icon)
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsContentType ADD CONSTRAINT
|
||||
IX_cmsContentType UNIQUE NONCLUSTERED
|
||||
(
|
||||
nodeId
|
||||
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsContent ADD CONSTRAINT
|
||||
IX_cmsContent UNIQUE NONCLUSTERED
|
||||
(
|
||||
nodeId
|
||||
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsContentVersion ADD CONSTRAINT
|
||||
FK_cmsContentVersion_cmsContent FOREIGN KEY
|
||||
(
|
||||
ContentId
|
||||
) REFERENCES dbo.cmsContent
|
||||
(
|
||||
nodeId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.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) ON [PRIMARY]
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsMember ADD CONSTRAINT
|
||||
FK_cmsMember_cmsContent FOREIGN KEY
|
||||
(
|
||||
nodeId
|
||||
) REFERENCES dbo.cmsContent
|
||||
(
|
||||
nodeId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsMember ADD CONSTRAINT
|
||||
FK_cmsMember_umbracoNode FOREIGN KEY
|
||||
(
|
||||
nodeId
|
||||
) REFERENCES dbo.umbracoNode
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.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) ON [PRIMARY]
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.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) ON [PRIMARY]
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsStylesheetProperty ADD CONSTRAINT
|
||||
FK_cmsStylesheetProperty_umbracoNode FOREIGN KEY
|
||||
(
|
||||
nodeId
|
||||
) REFERENCES dbo.umbracoNode
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsStylesheet ADD CONSTRAINT
|
||||
FK_cmsStylesheet_umbracoNode FOREIGN KEY
|
||||
(
|
||||
nodeId
|
||||
) REFERENCES dbo.umbracoNode
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsContentXml ADD CONSTRAINT
|
||||
FK_cmsContentXml_cmsContent FOREIGN KEY
|
||||
(
|
||||
nodeId
|
||||
) REFERENCES dbo.cmsContent
|
||||
(
|
||||
nodeId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsDataType ADD CONSTRAINT
|
||||
IX_cmsDataType UNIQUE NONCLUSTERED
|
||||
(
|
||||
nodeId
|
||||
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
;
|
||||
|
||||
|
||||
|
||||
ALTER TABLE dbo.cmsDataType ADD CONSTRAINT
|
||||
FK_cmsDataType_umbracoNode FOREIGN KEY
|
||||
(
|
||||
nodeId
|
||||
) REFERENCES dbo.umbracoNode
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
|
||||
|
||||
ALTER TABLE dbo.cmsDataTypePreValues ADD CONSTRAINT
|
||||
FK_cmsDataTypePreValues_cmsDataType FOREIGN KEY
|
||||
(
|
||||
datatypeNodeId
|
||||
) REFERENCES dbo.cmsDataType
|
||||
(
|
||||
nodeId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsDocument ADD CONSTRAINT
|
||||
FK_cmsDocument_cmsContent FOREIGN KEY
|
||||
(
|
||||
nodeId
|
||||
) REFERENCES dbo.cmsContent
|
||||
(
|
||||
nodeId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsDocumentType ADD CONSTRAINT
|
||||
FK_cmsDocumentType_cmsContentType FOREIGN KEY
|
||||
(
|
||||
contentTypeNodeId
|
||||
) REFERENCES dbo.cmsContentType
|
||||
(
|
||||
nodeId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsDocumentType ADD CONSTRAINT
|
||||
FK_cmsDocumentType_umbracoNode FOREIGN KEY
|
||||
(
|
||||
contentTypeNodeId
|
||||
) REFERENCES dbo.umbracoNode
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsMacroProperty ADD CONSTRAINT
|
||||
FK_cmsMacroProperty_cmsMacro FOREIGN KEY
|
||||
(
|
||||
macro
|
||||
) REFERENCES dbo.cmsMacro
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsMemberType ADD CONSTRAINT
|
||||
FK_cmsMemberType_cmsContentType FOREIGN KEY
|
||||
(
|
||||
NodeId
|
||||
) REFERENCES dbo.cmsContentType
|
||||
(
|
||||
nodeId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsMemberType ADD CONSTRAINT
|
||||
FK_cmsMemberType_umbracoNode FOREIGN KEY
|
||||
(
|
||||
NodeId
|
||||
) REFERENCES dbo.umbracoNode
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsMember2MemberGroup ADD CONSTRAINT
|
||||
FK_cmsMember2MemberGroup_cmsMember FOREIGN KEY
|
||||
(
|
||||
Member
|
||||
) REFERENCES dbo.cmsMember
|
||||
(
|
||||
nodeId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.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) ON [PRIMARY]
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsPropertyData ADD CONSTRAINT
|
||||
FK_cmsPropertyData_cmsPropertyType FOREIGN KEY
|
||||
(
|
||||
propertytypeid
|
||||
) REFERENCES dbo.cmsPropertyType
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsPropertyType ADD CONSTRAINT
|
||||
FK_cmsPropertyType_cmsContentType FOREIGN KEY
|
||||
(
|
||||
contentTypeId
|
||||
) REFERENCES dbo.cmsContentType
|
||||
(
|
||||
nodeId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsPropertyType ADD CONSTRAINT
|
||||
FK_cmsPropertyType_cmsDataType FOREIGN KEY
|
||||
(
|
||||
dataTypeId
|
||||
) REFERENCES dbo.cmsDataType
|
||||
(
|
||||
nodeId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsTab ADD CONSTRAINT
|
||||
FK_cmsTab_cmsContentType FOREIGN KEY
|
||||
(
|
||||
contenttypeNodeId
|
||||
) REFERENCES dbo.cmsContentType
|
||||
(
|
||||
nodeId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsTemplate ADD CONSTRAINT
|
||||
IX_cmsTemplate UNIQUE NONCLUSTERED
|
||||
(
|
||||
nodeId
|
||||
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsDocument ADD CONSTRAINT
|
||||
FK_cmsDocument_cmsTemplate FOREIGN KEY
|
||||
(
|
||||
templateId
|
||||
) REFERENCES dbo.cmsTemplate
|
||||
(
|
||||
nodeId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
|
||||
ALTER TABLE dbo.umbracoDomains ADD CONSTRAINT
|
||||
FK_umbracoDomains_umbracoNode FOREIGN KEY
|
||||
(
|
||||
domainRootStructureID
|
||||
) REFERENCES dbo.umbracoNode
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsDictionary ADD CONSTRAINT
|
||||
IX_cmsDictionary UNIQUE NONCLUSTERED
|
||||
(
|
||||
id
|
||||
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsLanguageText ADD CONSTRAINT
|
||||
FK_cmsLanguageText_cmsDictionary FOREIGN KEY
|
||||
(
|
||||
UniqueId
|
||||
) REFERENCES dbo.cmsDictionary
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
|
||||
|
||||
ALTER TABLE dbo.umbracoUser2NodeNotify ADD CONSTRAINT
|
||||
FK_umbracoUser2NodeNotify_umbracoUser FOREIGN KEY
|
||||
(
|
||||
userId
|
||||
) REFERENCES dbo.umbracoUser
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.umbracoUser2NodeNotify ADD CONSTRAINT
|
||||
FK_umbracoUser2NodeNotify_umbracoNode FOREIGN KEY
|
||||
(
|
||||
nodeId
|
||||
) REFERENCES dbo.umbracoNode
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.umbracoUser2NodePermission ADD CONSTRAINT
|
||||
FK_umbracoUser2NodePermission_umbracoUser FOREIGN KEY
|
||||
(
|
||||
userId
|
||||
) REFERENCES dbo.umbracoUser
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.umbracoUser2NodePermission ADD CONSTRAINT
|
||||
FK_umbracoUser2NodePermission_umbracoNode FOREIGN KEY
|
||||
(
|
||||
nodeId
|
||||
) REFERENCES dbo.umbracoNode
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsTask ADD CONSTRAINT
|
||||
FK_cmsTask_umbracoUser FOREIGN KEY
|
||||
(
|
||||
parentUserId
|
||||
) REFERENCES dbo.umbracoUser
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsTask ADD CONSTRAINT
|
||||
FK_cmsTask_umbracoUser1 FOREIGN KEY
|
||||
(
|
||||
userId
|
||||
) REFERENCES dbo.umbracoUser
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsTask ADD CONSTRAINT
|
||||
FK_cmsTask_umbracoNode FOREIGN KEY
|
||||
(
|
||||
nodeId
|
||||
) REFERENCES dbo.umbracoNode
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
CREATE NONCLUSTERED INDEX IX_umbracoLog ON dbo.umbracoLog
|
||||
(
|
||||
NodeId
|
||||
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.umbracoRelation ADD CONSTRAINT
|
||||
FK_umbracoRelation_umbracoRelationType FOREIGN KEY
|
||||
(
|
||||
relType
|
||||
) REFERENCES dbo.umbracoRelationType
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.umbracoRelation ADD CONSTRAINT
|
||||
FK_umbracoRelation_umbracoNode FOREIGN KEY
|
||||
(
|
||||
parentId
|
||||
) REFERENCES dbo.umbracoNode
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.umbracoRelation ADD CONSTRAINT
|
||||
FK_umbracoRelation_umbracoNode1 FOREIGN KEY
|
||||
(
|
||||
childId
|
||||
) REFERENCES dbo.umbracoNode
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
|
||||
|
||||
ALTER TABLE dbo.cmsContentTypeAllowedContentType ADD CONSTRAINT
|
||||
FK_cmsContentTypeAllowedContentType_cmsContentType FOREIGN KEY
|
||||
(
|
||||
Id
|
||||
) REFERENCES dbo.cmsContentType
|
||||
(
|
||||
nodeId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsContentTypeAllowedContentType ADD CONSTRAINT
|
||||
FK_cmsContentTypeAllowedContentType_cmsContentType1 FOREIGN KEY
|
||||
(
|
||||
AllowedId
|
||||
) REFERENCES dbo.cmsContentType
|
||||
(
|
||||
nodeId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.umbracoLanguage ADD CONSTRAINT
|
||||
IX_umbracoLanguage UNIQUE NONCLUSTERED
|
||||
(
|
||||
languageISOCode
|
||||
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.umbracoUser ADD CONSTRAINT
|
||||
IX_umbracoUser UNIQUE NONCLUSTERED
|
||||
(
|
||||
userLogin
|
||||
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsTaskType ADD CONSTRAINT
|
||||
IX_cmsTaskType UNIQUE NONCLUSTERED
|
||||
(
|
||||
alias
|
||||
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsDocumentType ADD CONSTRAINT
|
||||
FK_cmsDocumentType_cmsTemplate FOREIGN KEY
|
||||
(
|
||||
templateNodeId
|
||||
) REFERENCES dbo.cmsTemplate
|
||||
(
|
||||
nodeId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsTemplate ADD CONSTRAINT
|
||||
FK_cmsTemplate_cmsTemplate FOREIGN KEY
|
||||
(
|
||||
master
|
||||
) REFERENCES dbo.cmsTemplate
|
||||
(
|
||||
nodeId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsContentVersion ADD CONSTRAINT
|
||||
IX_cmsContentVersion UNIQUE NONCLUSTERED
|
||||
(
|
||||
VersionId
|
||||
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsPreviewXml ADD CONSTRAINT
|
||||
FK_cmsPreviewXml_cmsContentVersion FOREIGN KEY
|
||||
(
|
||||
versionId
|
||||
) REFERENCES dbo.cmsContentVersion
|
||||
(
|
||||
VersionId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsPreviewXml ADD CONSTRAINT
|
||||
FK_cmsPreviewXml_cmsContent FOREIGN KEY
|
||||
(
|
||||
nodeId
|
||||
) REFERENCES dbo.cmsContent
|
||||
(
|
||||
nodeId
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsMemberType ADD CONSTRAINT
|
||||
IX_cmsMemberType UNIQUE NONCLUSTERED
|
||||
(
|
||||
NodeId
|
||||
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||
;
|
||||
|
||||
ALTER TABLE dbo.cmsMember2MemberGroup ADD CONSTRAINT
|
||||
FK_cmsMember2MemberGroup_umbracoNode FOREIGN KEY
|
||||
(
|
||||
MemberGroup
|
||||
) REFERENCES dbo.umbracoNode
|
||||
(
|
||||
id
|
||||
) ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
;
|
||||
|
||||
|
||||
/***********************************************************************************************************************
|
||||
|
||||
END OF NEW CONSTRAINTS
|
||||
|
||||
/***********************************************************************************************************************
|
||||
Reference in New Issue
Block a user