Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
umbraco#3319 removed isClustered property from index definition
  • Loading branch information
dawoe committed Oct 23, 2018
1 parent 2ba214c commit 7fb9c2e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 20 deletions.
Expand Up @@ -158,8 +158,7 @@ public static IndexDefinition GetIndexDefinition(Type modelType, PropertyInfo pr
Name = indexName,
IndexType = attribute.IndexType,
ColumnName = columnName,
TableName = tableName,
IsClustered = attribute.IndexType == IndexTypes.Clustered,
TableName = tableName,
};

if (string.IsNullOrEmpty(attribute.ForColumns) == false)
Expand Down
Expand Up @@ -14,8 +14,7 @@ public IndexDefinition()
public virtual string SchemaName { get; set; }
public virtual string TableName { get; set; }
public virtual string ColumnName { get; set; }

public bool IsClustered { get; set; }

public virtual ICollection<IndexColumnDefinition> Columns { get; set; }
public IndexTypes IndexType { get; set; }
}
Expand Down
Expand Up @@ -47,34 +47,26 @@ public ICreateIndexOnColumnSyntax Descending()
}

ICreateIndexOnColumnSyntax ICreateIndexColumnOptionsSyntax.Unique()
{
//if it is Unique then it must be unique nonclustered and set the other flags
Expression.Index.IndexType = IndexTypes.UniqueNonClustered;
Expression.Index.IsClustered = false;
{
Expression.Index.IndexType = IndexTypes.UniqueNonClustered;
return this;
}

public ICreateIndexOnColumnSyntax NonClustered()
{
Expression.Index.IndexType = IndexTypes.NonClustered;
Expression.Index.IsClustered = false;

Expression.Index.IndexType = IndexTypes.NonClustered;
return this;
}

public ICreateIndexOnColumnSyntax Clustered()
{
//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;

return this;
Expression.Index.IndexType = IndexTypes.Clustered;
return this;
}

ICreateIndexOnColumnSyntax ICreateIndexOptionsSyntax.Unique()
{
Expression.Index.IndexType = IndexTypes.UniqueNonClustered;

Expression.Index.IndexType = IndexTypes.UniqueNonClustered;
return this;
}
}
Expand Down
Expand Up @@ -89,7 +89,7 @@ public void Format_SqlServer_NonClusteredIndexDefinition_UsingIsClusteredFalse_A
var sqlSyntax = new SqlServerSyntaxProvider();

var indexDefinition = CreateIndexDefinition();
indexDefinition.IsClustered = false;
indexDefinition.IndexType = IndexTypes.Clustered;

var actual = sqlSyntax.Format(indexDefinition);
Assert.AreEqual("CREATE CLUSTERED INDEX [IX_A] ON [TheTable] ([A])", actual);
Expand Down Expand Up @@ -159,4 +159,4 @@ private static IndexDefinition CreateIndexDefinition()
}

}
}
}

0 comments on commit 7fb9c2e

Please sign in to comment.