Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for CreateTable not always adding missing columns #21

Merged
merged 3 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified src/Plugins/SQLitePCLRaw/SQLitePCLRaw.core.dll
Binary file not shown.
Binary file modified src/Plugins/SQLitePCLRaw/SQLitePCLRaw.provider.internal.dll
Binary file not shown.
Binary file modified src/Plugins/SQLitePCLRaw/SQLitePCLRaw.provider.sqlite3.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion src/SQLite.Net/SQLite.Net2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<Title>sqlite-net2 light ORM for SQLite</Title>
<Description>sqlite-net2 allows applications to manage data in SQLite databases using Entity Framework like queries, but much lighter</Description>
<Product>$(AssemblyName) ($(TargetFramework))</Product>
<VersionSuffix>.9</VersionSuffix>
<VersionSuffix>.10</VersionSuffix>
<PackageVersion>$(Version)$(VersionSuffix)</PackageVersion>
<Authors>Benjamin Mayrargue</Authors>
<Owners>Benjamin Mayrargue</Owners>
Expand Down
8 changes: 2 additions & 6 deletions src/SQLite.Net/SQLiteConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,8 @@ public int CreateTable(Type ty, CreateFlags createFlags = CreateFlags.None)
sbQuery.Append(")");
var count = Execute(sbQuery.ToString());

if (count == 0)
{
//Possible bug: This always seems to return 0?
// Table already exists, migrate it
MigrateTable(map);
}
// add columns if necessary
MigrateTable(map);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this safely no-op?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's an empty for loop. In fact, if you read the old comment, this was known to be happening when they didn't want it to.


var indexes = new Dictionary<string, IndexInfo>();
foreach (var c in mapColumns)
Expand Down
Loading