Fixes db fluent index builder

This commit is contained in:
Shannon
2013-09-18 19:18:28 +10:00
parent 44cc095163
commit f0a141567e

View File

@@ -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;
}