Skip to content

Banded migration ids + set-difference runner - #2

Merged
kevinher7 merged 1 commit into
personalfrom
feature/kevin/banded-migration-runner
May 4, 2026
Merged

kevinher7 merged 1 commit into
personalfrom
feature/kevin/banded-migration-runner

Conversation

@kevinher7

Copy link
Copy Markdown
Owner

Summary

  • Custom set-difference Migrator runner replaces the stock max-id strategy so a downstream-only id (e.g. 5001) cannot silently block a future upstream id (e.g. 27) from running.
  • Banded id convention: upstream 1..999, downstream-only >= 5000. Enforced in CI by Migrations.test.ts.
  • First downstream migration 5001_ProjectionTags (creates projection_tags, adds tags_json to projection_projects with DEFAULT '[]').
  • Test-only fix: MigrationsRunner.test.ts now resets all user tables between sibling it.effect blocks because @effect/vitest's it.layer builds the layer with Effect.cached, sharing the in-memory SQLite across the suite.

Test plan

  • bun run typecheck from apps/server
  • vitest run src/persistence/Migrations.test.ts src/persistence/MigrationsRunner.test.ts src/persistence/Migrations/5001_ProjectionTags.test.ts (7/7 passing under Node 24)
  • Manual: start the server against an existing dev DB; confirm 5001 is recorded in effect_sql_migrations and tags_json appears on projection_projects.

Adds a custom Migrator runner that uses set-difference semantics over
effect_sql_migrations instead of the stock max-id strategy, plus a
banded-id convention (upstream 1..999, downstream-only >= 5000) so a
downstream-only migration cannot silently shadow a future upstream
migration during merges.

Also lands the first downstream migration, 5001_ProjectionTags, which
creates the projection_tags table and adds a tags_json column to
projection_projects (DEFAULT '[]').

The MigrationsRunner integration test resets all user tables between
sibling it.effect blocks because @effect/vitest's `it.layer` builds the
layer with `Effect.cached`, sharing the in-memory SQLite across the
suite.
@github-actions github-actions Bot added size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels May 4, 2026
@kevinher7 kevinher7 self-assigned this May 4, 2026
@kevinher7
kevinher7 merged commit 82c1db2 into personal May 4, 2026
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant