Skip to content

fix(db): correct migration when-timestamp ordering (0009/0010 skipped) - #36

Merged
MichaelLeeHobbs merged 1 commit into
mainfrom
fix/migration-timestamp-ordering
Jul 14, 2026
Merged

fix(db): correct migration when-timestamp ordering (0009/0010 skipped)#36
MichaelLeeHobbs merged 1 commit into
mainfrom
fix/migration-timestamp-ordering

Conversation

@MichaelLeeHobbs

Copy link
Copy Markdown
Owner

Hand-written migrations 0007/0008 had future-dated journal when values (~2026-07-14); 0009 (collections) and 0010 (data_sources), generated 2026-07-13 with real lower timestamps, sorted before them and were silently skipped by drizzle-kit migrate once 0008 was applied. Effect: fresh installs created neither collections nor data_sources, and the dev DB was missing data_sources (the Data Sources page returned 500 on "relation does not exist").

Fix: bumped 0009 and 0010 journal when values above 0008 so all timestamps are monotonic by idx. Verified: a from-scratch drizzle-kit migrate now creates both tables. See DECISIONS D-179.

No schema/SQL change — journal metadata only.

🤖 Generated with Claude Code

https://claude.ai/code/session_01F1ad6jb5mCYxzFVXHbksqi

Hand-written 0007/0008 had future-dated journal `when` values (~2026-07-14);
0009 (collections) and 0010 (data_sources), generated 2026-07-13 with real
lower timestamps, sorted before them and were silently skipped by drizzle-kit
migrate once 0008 was applied — so fresh installs created neither table and the
dev DB was missing data_sources (Data Sources page 500'd).

Bumped 0009→1784000200000, 0010→1784000300000 so all `when`s are monotonic by
idx. Verified a from-scratch migrate now creates collections + data_sources.
DECISIONS D-179.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F1ad6jb5mCYxzFVXHbksqi
Copilot AI review requested due to automatic review settings July 14, 2026 21:16
@MichaelLeeHobbs
MichaelLeeHobbs merged commit 25d873e into main Jul 14, 2026
1 of 3 checks passed
@MichaelLeeHobbs
MichaelLeeHobbs deleted the fix/migration-timestamp-ordering branch July 14, 2026 21:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes Drizzle migration application order by correcting the when timestamps in the Drizzle migrations journal so migrations 0009 (collections) and 0010 (data_sources) are no longer skipped after applying 0008. This addresses fresh-install and dev DB failures where the collections and/or data_sources tables were missing due to non-monotonic journal timestamps.

Changes:

  • Updated meta/_journal.json to bump migration 0009 and 0010 when values so they are monotonic with idx and greater than 0008.
  • Added Decision D-179 documenting the root cause, impact, and the fix rationale.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/server/src/db/migrations/meta/_journal.json Adjusts Drizzle journal when timestamps for migrations 0009/0010 to ensure they are applied after 0008 rather than skipped.
docs/progress/DECISIONS.md Documents the migration-ordering incident and resolution as Decision D-179 for future reference.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants