Skip to content

Commit 44992b1

Browse files
committed
Fix for CreateTable not always adding missing columns
This would happen when a previous INSERT/UPDATE/DELETE statement query modified rows. The existing code was incorrectly attempting to check whether a CREATE IF NOT EXISTS statement did anything. https://www.sqlite.org/c3ref/changes.html
1 parent c6556e2 commit 44992b1

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/SQLite.Net/SQLiteConnection.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,12 +335,8 @@ public int CreateTable(Type ty, CreateFlags createFlags = CreateFlags.None)
335335
sbQuery.Append(")");
336336
var count = Execute(sbQuery.ToString());
337337

338-
if (count == 0)
339-
{
340-
//Possible bug: This always seems to return 0?
341-
// Table already exists, migrate it
342-
MigrateTable(map);
343-
}
338+
// add columns if necessary
339+
MigrateTable(map);
344340

345341
var indexes = new Dictionary<string, IndexInfo>();
346342
foreach (var c in mapColumns)

0 commit comments

Comments
 (0)