diff --git a/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/Index/CreateIndexBuilder.cs b/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/Index/CreateIndexBuilder.cs index 405e013545..c91c1de469 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/Index/CreateIndexBuilder.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Syntax/Create/Index/CreateIndexBuilder.cs @@ -1,4 +1,5 @@ -using Umbraco.Core.Persistence.DatabaseModelDefinitions; +using Umbraco.Core.Persistence.DatabaseAnnotations; +using Umbraco.Core.Persistence.DatabaseModelDefinitions; using Umbraco.Core.Persistence.Migrations.Syntax.Expressions; namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Index @@ -48,18 +49,27 @@ namespace Umbraco.Core.Persistence.Migrations.Syntax.Create.Index ICreateIndexOnColumnSyntax ICreateIndexColumnOptionsSyntax.Unique() { Expression.Index.IsUnique = true; + //if it is Unique then it must be unique nonclustered and set the other flags + Expression.Index.IndexType = IndexTypes.UniqueNonClustered; + Expression.Index.IsClustered = false; return this; } public ICreateIndexOnColumnSyntax NonClustered() { Expression.Index.IsClustered = false; + Expression.Index.IndexType = IndexTypes.NonClustered; + Expression.Index.IsUnique = false; return this; } public ICreateIndexOnColumnSyntax Clustered() { Expression.Index.IsClustered = true; + //if it is clustered then we have to change the index type set the other flags + Expression.Index.IndexType = IndexTypes.Clustered; + Expression.Index.IsClustered = true; + Expression.Index.IsUnique = false; return this; }