Fixing foreignkey issues
This commit is contained in:
@@ -11,7 +11,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
{
|
||||
[Column("nodeId")]
|
||||
[PrimaryKeyColumn(AutoIncrement = false)]
|
||||
[ForeignKey(typeof(ContentDto))]
|
||||
[ForeignKey(typeof(ContentDto), Column = "nodeId")]
|
||||
public int NodeId { get; set; }
|
||||
|
||||
[Column("xml")]
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Umbraco.Core.Models.Rdbms
|
||||
|
||||
[Column("templateId")]
|
||||
[NullSetting(NullSetting = NullSettings.Null)]
|
||||
[ForeignKey(typeof(TemplateDto))]
|
||||
[ForeignKey(typeof(TemplateDto), Column = "nodeId")]
|
||||
public int? TemplateId { get; set; }
|
||||
|
||||
[Column("alias")]
|
||||
|
||||
@@ -305,7 +305,7 @@ namespace Umbraco.Core.Persistence.Migrations.Initial
|
||||
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,|1|1,2,3,|0|500,400|1049,|true|',0,N''"
|
||||
Value = ",code,undo,redo,cut,copy,mcepasteword,stylepicker,bold,italic,bullist,numlist,outdent,indent,mcelink,unlink,mceinsertanchor,mceimage,umbracomacro,mceinserttable,umbracoembed,mcecharmap,|1|1,2,3,|0|500,400|1049,|true|"
|
||||
});
|
||||
|
||||
_database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto
|
||||
|
||||
@@ -73,14 +73,12 @@ namespace Umbraco.Core.Persistence
|
||||
if(!string.IsNullOrEmpty(createPrimaryKeySql))
|
||||
db.Execute(new Sql(createPrimaryKeySql));
|
||||
|
||||
if (DatabaseContext.Current.ProviderName.Contains("SqlServerCe") == false)
|
||||
//Loop through foreignkey statements and execute sql
|
||||
foreach (var sql in foreignSql)
|
||||
{
|
||||
//Loop through foreignkey statements and execute sql
|
||||
foreach (var sql in foreignSql)
|
||||
{
|
||||
int createdFk = db.Execute(new Sql(sql));
|
||||
}
|
||||
int createdFk = db.Execute(new Sql(sql));
|
||||
}
|
||||
|
||||
//Loop through index statements and execute sql
|
||||
foreach (var sql in indexSql)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Umbraco.Core.Persistence.Migrations.Model;
|
||||
using Umbraco.Core.Persistence.DatabaseAnnotations;
|
||||
using Umbraco.Core.Persistence.Migrations.Model;
|
||||
using ColumnDefinition = Umbraco.Core.Persistence.SqlSyntax.ModelDefinitions.ColumnDefinition;
|
||||
|
||||
namespace Umbraco.Core.Persistence.SqlSyntax
|
||||
@@ -35,6 +36,23 @@ namespace Umbraco.Core.Persistence.SqlSyntax
|
||||
InitColumnTypeMap();
|
||||
}
|
||||
|
||||
public override string GetIndexType(IndexTypes indexTypes)
|
||||
{
|
||||
string indexType;
|
||||
//NOTE Sql Ce doesn't support clustered indexes
|
||||
if (indexTypes == IndexTypes.Clustered)
|
||||
{
|
||||
indexType = "NONCLUSTERED";
|
||||
}
|
||||
else
|
||||
{
|
||||
indexType = indexTypes == IndexTypes.NonClustered
|
||||
? "NONCLUSTERED"
|
||||
: "UNIQUE NONCLUSTERED";
|
||||
}
|
||||
return indexType;
|
||||
}
|
||||
|
||||
public override string GetQuotedTableName(string tableName)
|
||||
{
|
||||
return string.Format("[{0}]", tableName);
|
||||
|
||||
Reference in New Issue
Block a user