Skip to content

Fix DuckDB migration ordering after archive-and-reset#314

Merged
erikdarlingdata merged 1 commit intodevfrom
fix/duckdb-migration-ordering
Feb 26, 2026
Merged

Fix DuckDB migration ordering after archive-and-reset#314
erikdarlingdata merged 1 commit intodevfrom
fix/duckdb-migration-ordering

Conversation

@erikdarlingdata
Copy link
Owner

Summary

  • PR Fix Int16 cast and DuckDB migration ordering #313 moved CREATE TABLE before migrations, but migrations v2/v6/v7/v8 use DROP TABLE IF EXISTS — so tables were created then immediately dropped on fresh databases
  • Correct fix: skip migrations entirely when existingVersion == 0 (fresh/reset DB has nothing to migrate)
  • All 6 Lite.Tests pass locally

Test plan

  • dotnet test Lite.Tests — all 6 tests pass (including InitializeAsync_CreatesAllTables and InitializeAsync_CreatesIndexes that were failing on CI)
  • CI pipeline should pass on this PR

🤖 Generated with Claude Code

The previous fix (PR #313) moved CREATE TABLE before migrations, but
migrations v2/v6/v7/v8 DROP TABLE IF EXISTS then expect CREATE TABLE
to follow — so tables were created then immediately dropped.

Correct fix: skip migrations entirely on fresh/reset databases (v0).
When existingVersion is 0, there's nothing to migrate — just create
tables with the current schema and stamp the version.

Fixes CI test failures: InitializeAsync_CreatesAllTables,
InitializeAsync_CreatesIndexes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit 3629bc2 into dev Feb 26, 2026
3 checks passed
@erikdarlingdata erikdarlingdata deleted the fix/duckdb-migration-ordering branch February 26, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant