Skip to content

Commit c7e5f4a

Browse files
committed
Made IsUnique PostgreSQL index setting set NullsNotDistinct to false when is not unique
1 parent e6c1b01 commit c7e5f4a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Weasel.Postgresql/Tables/IndexDefinition.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class IndexDefinition: INamed
2121
private string? _customIndexMethod;
2222

2323
private string? _indexName;
24+
private bool _isUnique;
2425

2526
public IndexDefinition(string indexName)
2627
{
@@ -62,7 +63,17 @@ public string? CustomMethod
6263
/// <summary>
6364
/// Option to create unique index
6465
/// </summary>
65-
public bool IsUnique { get; set; }
66+
public bool IsUnique
67+
{
68+
get => _isUnique;
69+
set
70+
{
71+
_isUnique = value;
72+
73+
if (_isUnique == false)
74+
NullsNotDistinct = false;
75+
}
76+
}
6677

6778
/// <summary>
6879
/// Should unique index consider nulls non distinct.

0 commit comments

Comments
 (0)