Skip to content

Commit 313ae15

Browse files
Ja bist du narrischJa bist du narrisch
authored andcommitted
Use HasFlag
1 parent 2098ea1 commit 313ae15

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

doc/ReleaseNotes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#### ColumnProperty
88
+ Removed `ForeignKey` use method `AddForeignKey(...)` instead.
9+
+ `Unique` is now obsolete because you cannot add a constraint name using it. Removing it by name is therefore impossible without investigation.
910

1011
### Other changes
1112
Several fixes see PRs

src/Migrator/Framework/ColumnProperty.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public enum ColumnProperty
3737
Indexed = 1 << 4,
3838

3939
/// <summary>
40-
/// Unsigned Column. Not used in SQLite (there is only)
40+
/// Unsigned Column. Not used in SQLite there is only on integer data type INTEGER.
4141
/// </summary>
4242
Unsigned = 1 << 5,
4343

src/Migrator/Framework/ColumnPropertyExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ public static class ColumnPropertyExtensions
66
{
77
public static bool IsSet(this ColumnProperty columnProperty, ColumnProperty flags)
88
{
9-
return flags != ColumnProperty.None && (columnProperty & flags) == flags;
9+
return flags != 0 && columnProperty.HasFlag(flags);
1010
}
1111

1212
public static bool IsNotSet(this ColumnProperty columnProperty, ColumnProperty flags)
1313
{
14-
return (columnProperty & flags) == 0;
14+
return flags == 0 || !columnProperty.HasFlag(flags);
1515
}
1616

1717
public static ColumnProperty Set(this ColumnProperty columnProperty, ColumnProperty flags)
1818
{
19-
return columnProperty | flags;
19+
return columnProperty |= flags;
2020
}
2121

2222
public static ColumnProperty Clear(this ColumnProperty columnProperty, ColumnProperty flags)
2323
{
24-
return columnProperty & (~flags);
24+
return columnProperty &= ~flags;
2525
}
2626
}

0 commit comments

Comments
 (0)