Fix the DB creation and population (tested only on SQL CE so far)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Umbraco.Core.Persistence;
|
||||
using System.Data;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
|
||||
namespace Umbraco.Core.Models.Rdbms
|
||||
@@ -10,10 +11,11 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
{
|
||||
[Column("nodeId")]
|
||||
[PrimaryKeyColumn(AutoIncrement = false)]
|
||||
[ForeignKey(typeof(ContentDto))]
|
||||
//[ForeignKey(typeof(ContentDto))]
|
||||
public int NodeId { get; set; }
|
||||
|
||||
[Column("xml")]
|
||||
[SpecialDbType(SpecialDbTypes.NTEXT)]
|
||||
public string Xml { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column("datatypeNodeId")]
|
||||
[ForeignKey(typeof(DataTypeDto), Column = "nodeId")]
|
||||
//[ForeignKey(typeof(DataTypeDto), Column = "nodeId")]
|
||||
public int DataTypeNodeId { get; set; }
|
||||
|
||||
[Column("value")]
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
|
||||
[Column("templateId")]
|
||||
[NullSetting(NullSetting = NullSettings.Null)]
|
||||
[ForeignKey(typeof(TemplateDto))]
|
||||
//[ForeignKey(typeof(TemplateDto))]
|
||||
public int? TemplateId { get; set; }
|
||||
|
||||
[Column("alias")]
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column("taskTypeId")]
|
||||
[ForeignKey(typeof(TaskTypeDto))]
|
||||
//[ForeignKey(typeof(TaskTypeDto))]
|
||||
public byte TaskTypeId { get; set; }
|
||||
|
||||
[Column("nodeId")]
|
||||
|
||||
@@ -77,10 +77,19 @@ namespace Umbraco.Core.Persistence.Migrations.Initial
|
||||
CreateCmsDataTypeData();
|
||||
}
|
||||
|
||||
if (tableName.Equals("cmsDataTypePreValues"))
|
||||
{
|
||||
CreateCmsDataTypePreValuesData();
|
||||
}
|
||||
|
||||
if (tableName.Equals("umbracoRelationType"))
|
||||
{
|
||||
CreateUmbracoRelationTypeData();
|
||||
}
|
||||
if (tableName.Equals("cmsTaskType"))
|
||||
{
|
||||
CreateCmsTaskTypeData();
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateUmbracNodeData()
|
||||
@@ -127,8 +136,8 @@ namespace Umbraco.Core.Persistence.Migrations.Initial
|
||||
private void CreateCmsContentTypeData()
|
||||
{
|
||||
_database.Insert(new ContentTypeDto { PrimaryKey = 532, NodeId = 1031, Alias = "Folder", Icon = "folder.gif", Thumbnail = "folder.png", IsContainer = true, AllowAtRoot = true });
|
||||
_database.Insert(new ContentTypeDto { PrimaryKey = 533, NodeId = 1032, Alias = "Image", Icon = "mediaPhoto.gif", Thumbnail = "folder.png" });
|
||||
_database.Insert(new ContentTypeDto { PrimaryKey = 534, NodeId = 1033, Alias = "File", Icon = "mediaFile.gif", Thumbnail = "folder.png" });
|
||||
_database.Insert(new ContentTypeDto { PrimaryKey = 533, NodeId = 1032, Alias = "Image", Icon = "mediaPhoto.gif", Thumbnail = "mediaPhoto.png" });
|
||||
_database.Insert(new ContentTypeDto { PrimaryKey = 534, NodeId = 1033, Alias = "File", Icon = "mediaFile.gif", Thumbnail = "mediaFile.png" });
|
||||
}
|
||||
|
||||
private void CreateUmbracoUserData()
|
||||
@@ -285,7 +294,32 @@ namespace Umbraco.Core.Persistence.Migrations.Initial
|
||||
}
|
||||
|
||||
private void CreateCmsDataTypePreValuesData()
|
||||
{}
|
||||
{
|
||||
using (var transaction = _database.GetTransaction())
|
||||
{
|
||||
_database.Execute(new Sql("SET IDENTITY_INSERT [cmsDataTypePreValues] ON "));
|
||||
_database.Insert("cmsDataTypePreValues", "id", false,
|
||||
new DataTypePreValueDto
|
||||
{
|
||||
Id = 3,
|
||||
Alias = "",
|
||||
SortOrder = 0,
|
||||
DataTypeNodeId = -87,
|
||||
Value = ",code,undo,redo,cut,copy,mcepasteword,stylepicker,bold,italic,bullist,numlist,outdent,indent,mcelink,unlink,mceinsertanchor,mceimage,umbracomacro,mceinserttable,umbracoembed,mcecharmap,' + char(124) + '1' + char(124) + '1,2,3,' + char(124) + '0' + char(124) + '500,400' + char(124) + '1049,' + char(124) + 'true' + char(124) + '"
|
||||
});
|
||||
_database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto
|
||||
{
|
||||
Id = 4,
|
||||
Alias = "group",
|
||||
SortOrder = 0,
|
||||
DataTypeNodeId = 1041,
|
||||
Value = "default"
|
||||
});
|
||||
_database.Execute(new Sql("SET IDENTITY_INSERT [cmsDataTypePreValues] OFF;"));
|
||||
|
||||
transaction.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateUmbracoRelationTypeData()
|
||||
{
|
||||
@@ -309,24 +343,18 @@ namespace Umbraco.Core.Persistence.Migrations.Initial
|
||||
}
|
||||
|
||||
private void CreateCmsTaskTypeData()
|
||||
{ }
|
||||
{
|
||||
//TODO: It tries to do an identity insert it seems, why? Error: The column cannot be modified. [ Column name = id ]
|
||||
//using (var transaction = _database.GetTransaction())
|
||||
//{
|
||||
// _database.Insert("cmsTaskType", "id", false,
|
||||
// new TaskTypeDto
|
||||
// {
|
||||
// Alias = "toTranslate"
|
||||
// });
|
||||
|
||||
/*
|
||||
|
||||
* SET IDENTITY_INSERT [cmsDataTypePreValues] ON
|
||||
insert into cmsDataTypePreValues (id, dataTypeNodeId, [value], sortorder, alias)
|
||||
values (3,-87,',code,undo,redo,cut,copy,mcepasteword,stylepicker,bold,italic,bullist,numlist,outdent,indent,mcelink,unlink,mceinsertanchor,mceimage,umbracomacro,mceinserttable,umbracoembed,mcecharmap,' + char(124) + '1' + char(124) + '1,2,3,' + char(124) + '0' + char(124) + '500,400' + char(124) + '1049,' + char(124) + 'true' + char(124) + '', 0, '')
|
||||
|
||||
insert into cmsDataTypePreValues (id, dataTypeNodeId, [value], sortorder, alias)
|
||||
values (4,1041,'default', 0, 'group')
|
||||
|
||||
SET IDENTITY_INSERT [cmsDataTypePreValues] OFF
|
||||
;
|
||||
|
||||
*
|
||||
*
|
||||
|
||||
insert into cmsTaskType (alias) values ('toTranslate');
|
||||
*/
|
||||
// transaction.Complete();
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,14 @@ namespace Umbraco.Tests.Routing
|
||||
Umbraco.Core.Configuration.UmbracoSettings.UseLegacyXmlSchema = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// We don't need a db for this test, will run faster without one
|
||||
/// </summary>
|
||||
protected override bool RequiresDbSetup
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
[TestCase("/this/is/my/alias", 1046)]
|
||||
[TestCase("/anotheralias", 1046)]
|
||||
[TestCase("/page2/alias", 1173)]
|
||||
|
||||
Reference in New Issue
Block a user