Skip to content

db snapshots fixed#219

Merged
AnuMonachan merged 1 commit into
mainfrom
fix/migration
Jul 9, 2026
Merged

db snapshots fixed#219
AnuMonachan merged 1 commit into
mainfrom
fix/migration

Conversation

@AnuMonachan

@AnuMonachan AnuMonachan commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

db snapshots fixed for 12 and 14

Summary by CodeRabbit

  • Chores
    • Updated database migration tracking to reflect the latest schema history.
    • Added a new migration snapshot to keep the database structure record up to date.
    • Refreshed migration timestamps and references for consistency.

@AnuMonachan AnuMonachan requested a review from kaseywright July 9, 2026 11:38
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a new database migration snapshot (0014) containing full schema definitions for tables, indexes, foreign keys, enums, and RLS flags, updates the prevId reference in the 0012 snapshot to chain to the new migration, and updates the journal's timestamp entry for migration 14.

Changes

Database migration snapshot addition

Layer / File(s) Summary
New migration snapshot schema definitions
src/db/migrations/meta/0014_snapshot.json
Adds snapshot header metadata, complete table schema (columns, indexes, foreign keys, composite primary keys, unique constraints, RLS flags), enum definitions, and remaining scaffolding fields (schemas, sequences, roles, policies, views, _meta).
Migration chain linkage updates
src/db/migrations/meta/0012_snapshot.json, src/db/migrations/meta/_journal.json
Updates the prevId in the 0012 snapshot to point to the new migration UUID and updates the journal's when timestamp for the idx 14 entry.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is related to the migration snapshot changes, but it is too generic to describe the main update clearly. Use a more specific title such as "Update database migration snapshots for 12 and 14".
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/migration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AnuMonachan AnuMonachan merged commit 3fd1027 into main Jul 9, 2026
1 of 2 checks passed

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/db/migrations/meta/0014_snapshot.json`:
- Around line 753-810: Add a composite primary key or unique constraint to the
join-table FK columns so duplicate links cannot be inserted. Update the snapshot
entries for bible_books and project_unit_bible_books in the migration metadata
to define uniqueness across their foreign key pairs, matching the existing table
structure and the join-table semantics.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: fbb95e7d-f671-49f3-9b26-c6a064cd3c10

📥 Commits

Reviewing files that changed from the base of the PR and between 6d929f6 and 1ac9d27.

📒 Files selected for processing (3)
  • src/db/migrations/meta/0012_snapshot.json
  • src/db/migrations/meta/0014_snapshot.json
  • src/db/migrations/meta/_journal.json

Comment on lines +753 to +810
"public.bible_books": {
"name": "bible_books",
"schema": "",
"columns": {
"bible_id": {
"name": "bible_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"book_id": {
"name": "book_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"bible_books_bible_id_bibles_id_fk": {
"name": "bible_books_bible_id_bibles_id_fk",
"tableFrom": "bible_books",
"tableTo": "bibles",
"columnsFrom": ["bible_id"],
"columnsTo": ["id"],
"onDelete": "no action",
"onUpdate": "no action"
},
"bible_books_book_id_books_id_fk": {
"name": "bible_books_book_id_books_id_fk",
"tableFrom": "bible_books",
"tableTo": "books",
"columnsFrom": ["book_id"],
"columnsTo": ["id"],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Add uniqueness to the association tables.

bible_books and project_unit_bible_books are pure join tables, but neither declares a composite PK or unique constraint on its FK columns. That allows duplicate links to be inserted and can skew downstream joins/counts.

Also applies to: 1905-1977

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/db/migrations/meta/0014_snapshot.json` around lines 753 - 810, Add a
composite primary key or unique constraint to the join-table FK columns so
duplicate links cannot be inserted. Update the snapshot entries for bible_books
and project_unit_bible_books in the migration metadata to define uniqueness
across their foreign key pairs, matching the existing table structure and the
join-table semantics.

@github-actions github-actions Bot deleted the fix/migration branch July 9, 2026 11: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.

2 participants