Skip to content

Commit

Permalink
umbraco#3319 make sure indexes are creates as unique when using .Uniq…
Browse files Browse the repository at this point in the history
…ue() method in the syntaxbuilder
  • Loading branch information
dawoe committed Oct 19, 2018
1 parent f993869 commit ffdf3a4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Data;
using Umbraco.Core.Persistence.DatabaseAnnotations;
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Expressions;
using Umbraco.Core.Persistence.Migrations.Syntax.Expressions;
Expand Down Expand Up @@ -140,9 +141,12 @@ public IAlterColumnOptionSyntax Unique(string indexName)
Name = indexName,
SchemaName = Expression.SchemaName,
TableName = Expression.TableName,
IsUnique = true
IsUnique = true,
IndexType = IndexTypes.UniqueNonClustered
});



index.Index.Columns.Add(new IndexColumnDefinition
{
Name = Expression.Column.Name
Expand Down Expand Up @@ -242,4 +246,4 @@ public IAlterColumnOptionSyntax OnDeleteOrUpdate(Rule rule)
return this;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Data;
using Umbraco.Core.Persistence.DatabaseAnnotations;
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
using Umbraco.Core.Persistence.Migrations.Syntax.Alter.Expressions;
using Umbraco.Core.Persistence.Migrations.Syntax.Expressions;
Expand Down Expand Up @@ -125,7 +126,8 @@ public IAlterTableColumnOptionSyntax Unique(string indexName)
Name = indexName,
SchemaName = Expression.SchemaName,
TableName = Expression.TableName,
IsUnique = true
IsUnique = true,
IndexType = IndexTypes.UniqueNonClustered
});

index.Index.Columns.Add(new IndexColumnDefinition
Expand Down Expand Up @@ -259,4 +261,4 @@ public IAlterTableColumnOptionSyntax OnDeleteOrUpdate(Rule rule)
return this;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Data;
using Umbraco.Core.Persistence.DatabaseAnnotations;
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
using Umbraco.Core.Persistence.Migrations.Syntax.Expressions;
using Umbraco.Core.Persistence.SqlSyntax;
Expand Down Expand Up @@ -115,7 +116,8 @@ public ICreateColumnOptionSyntax Unique(string indexName)
Name = indexName,
SchemaName = Expression.SchemaName,
TableName = Expression.TableName,
IsUnique = true
IsUnique = true,
IndexType = IndexTypes.UniqueNonClustered
});

index.Index.Columns.Add(new IndexColumnDefinition
Expand Down Expand Up @@ -217,4 +219,4 @@ public ICreateColumnOptionSyntax OnDeleteOrUpdate(Rule rule)
return this;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Data;
using Umbraco.Core.Persistence.DatabaseAnnotations;
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
using Umbraco.Core.Persistence.Migrations.Syntax.Create.Expressions;
using Umbraco.Core.Persistence.Migrations.Syntax.Expressions;
Expand Down Expand Up @@ -165,7 +166,8 @@ public ICreateTableColumnOptionSyntax Unique(string indexName)
Name = indexName,
SchemaName = Expression.SchemaName,
TableName = Expression.TableName,
IsUnique = true
IsUnique = true,
IndexType = IndexTypes.UniqueNonClustered
});

index.Index.Columns.Add(new IndexColumnDefinition
Expand Down Expand Up @@ -267,4 +269,4 @@ public ICreateTableColumnOptionSyntax OnDeleteOrUpdate(Rule rule)
return this;
}
}
}
}

0 comments on commit ffdf3a4

Please sign in to comment.