Skip to content

Commit c6f18e8

Browse files
authored
fix: run initial delete only when target version is unset (#103)
Use CurrentVersion < 0 instead of <= 1 so WHEN NOT MATCHED BY SOURCE (initial delete) runs only for tables that have never been synced, not for version 0 or 1.
1 parent d9c01cd commit c6f18e8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/SqlBulkSyncFunction/Helpers/SqlStatementExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ THEN UPDATE
118118
: string.Empty
119119
),
120120
(
121-
(tableSchema.TargetVersion.CurrentVersion <= 1)
121+
(tableSchema.TargetVersion.CurrentVersion < 0)
122122
? """
123123
124124
WHEN NOT MATCHED BY SOURCE
@@ -250,7 +250,7 @@ public static string GetDeletedAtSourceSelectStatement(this TableSchema tableSch
250250
.Where(column => column.IsPrimary)
251251
.ToArray();
252252

253-
if (tableSchema.TargetVersion.CurrentVersion <= 1)
253+
if (tableSchema.TargetVersion.CurrentVersion < 0)
254254
{
255255
return string.Format(
256256
"""

0 commit comments

Comments
 (0)