Refactoring identity inserts in db creation phase to support mysql
This commit is contained in:
@@ -28,6 +28,10 @@ namespace Umbraco.Core.Persistence.SqlSyntax.ModelDefinitions
|
||||
var columnAttribute = propertyInfo.FirstAttribute<ColumnAttribute>();
|
||||
string columnName = columnAttribute != null ? columnAttribute.Name : propertyInfo.Name;
|
||||
|
||||
//Use PetaPoco's PrimaryKeyAttribute to set Identity property on TableDefinition
|
||||
var primaryKeyAttribute = modelType.FirstAttribute<PrimaryKeyAttribute>();
|
||||
tableDefinition.IsIdentity = primaryKeyAttribute != null && primaryKeyAttribute.autoIncrement;
|
||||
|
||||
//Creates a column definition and adds it to the collection on the table definition
|
||||
var columnDefinition = new ColumnDefinition
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace Umbraco.Core.Persistence.SqlSyntax.ModelDefinitions
|
||||
}
|
||||
|
||||
public string TableName { get; set; }
|
||||
public bool IsIdentity { get; set; }
|
||||
public bool IsPrimaryKeyClustered
|
||||
{
|
||||
get { return ColumnDefinitions.Any(x => x.IsPrimaryKeyClustered); }
|
||||
|
||||
Reference in New Issue
Block a user