Skip to content

Fix Int16 cast and DuckDB migration ordering#313

Merged
erikdarlingdata merged 1 commit intodevfrom
fix/error-log-cleanup
Feb 26, 2026
Merged

Fix Int16 cast and DuckDB migration ordering#313
erikdarlingdata merged 1 commit intodevfrom
fix/error-log-cleanup

Conversation

@erikdarlingdata
Copy link
Owner

Summary

  • Fix Unable to cast System.Int16 to System.Int32 in long-running query alert polling (session_id is smallint in DMVs)
  • Fix DuckDB ALTER TABLE ... Table does not exist errors after archive-and-reset by running CREATE TABLE before migrations

Test plan

  • Dashboard: 0 errors after 3 minutes (only SMTP config failure, not code)
  • Lite: 0 errors after 3 minutes
  • Both build with 0 errors

…ering

- NocHealth: session_id is smallint in DMVs, use Convert.ToInt32 instead
  of reader.GetInt32 to avoid "Unable to cast System.Int16 to System.Int32"
- DuckDbInitializer: run CREATE TABLE before ALTER TABLE migrations so
  migrations don't fail against nonexistent tables after archive-and-reset

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit 7b50eff into dev Feb 26, 2026
@erikdarlingdata erikdarlingdata deleted the fix/error-log-cleanup branch February 26, 2026 13:14
erikdarlingdata added a commit that referenced this pull request Feb 26, 2026
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>
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