Skip to content

Add migration 0021 integration test - #485

Merged
neuromechanist merged 2 commits into
devfrom
feature/issue-479-migration-test
May 14, 2026
Merged

neuromechanist merged 2 commits into
devfrom
feature/issue-479-migration-test

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Closes #479

Summary

What is tested

  1. All 10 fixture rows preserved verbatim after table rebuild (id, all columns)
  2. New CHECK accepts user:alex, user:cool-vibers, and all original enum values
  3. New CHECK rejects unknown, Users:alex (capital U), empty string, and user without colon
  4. AUTOINCREMENT sequence continues above the max pre-migration id
  5. Both idx_broadcast_sent_at and idx_broadcast_sent_by exist on broadcast_emails after rename
  6. No stale broadcast_emails_new table remains

Notable finding

bun:sqlite's exec() silently swallows CHECK constraint violations when the SQL string has leading whitespace (multi-statement execution path quirk). The execInsert() helper uses prepare(sql.trim()).run() to ensure errors are always surfaced. This is documented in the test file.

Test run

bun test backend/test/migrations.test.ts
14 pass, 0 fail, 106 expect() calls

@github-actions

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR485

Version: 0.8.14-PR485.8424937
Commit: 8424937


🤖 Updated on each push.

@neuromechanist
neuromechanist merged commit 03fe1b0 into dev May 14, 2026
2 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-479-migration-test branch May 14, 2026 12:33

This branch was previously deployed

1 inactive deployment
npm — cb42786f Deployed May 14, 2026 by neuromechanist via publish #854
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