Repository navigation
Let notes be about any record, not only an attendee #1978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
stefan-burke
merged 18 commits into
main
from
claude/site-tidyup-migrations-status-yl8jsv
Jul 28, 2026
Merged
Changes from 6 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
5ee5a50
WIP: notes are about a record, not only an attendee — NOT VERIFIED, f…
claude 8d97fc2
Retire the attendee-only index from the note table's first migration
claude 2eec413
Answer the schema, registry and code-quality checks the change moves
claude 873189f
Open one note through the same opener as a batch
claude 506d29a
Put the note routes' tests where the source can find them, and let a …
claude fc912b9
Give the new files direct tests, and record the four modules that hav…
claude 8063d91
Answer the review: read the primary, refuse an empty ask, fix the plans
claude eec0f5b
Answer the second review: cover the walk fix, read one the same way a…
claude cb1c0dd
Ask whether it is a directory before reading it
claude bb7beb2
Read a folder's contents one way across the scripts
claude 4f459d6
Answer the third review: strict walker, resumable index, batched note…
claude 7ba7447
Say what happens when adding a column fails for another reason
claude d2b4a29
Take the database's word on every step, not just adding a column
claude b72a98e
Pin each step's tolerance to its own answer, and drop a call that did…
claude 6a0fec5
Merge remote-tracking branch 'origin/main' into claude/site-tidyup-mi…
claude 25e7844
Re-anchor equivalent mutants after merging main
claude 2c5ffa7
Point the importer plan at where the notes store now lives
claude 21e7fd2
Assert the empty note delete really asks the database nothing
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import { bareSchemaMigration } from "./define.ts"; | ||
|
|
||
| /** | ||
| * Notes used to belong to an attendee and nothing else. They now name the kind | ||
| * of record they are about and which one, so any record can carry notes. | ||
| * | ||
| * The two new columns are added with a default so the database accepts them on | ||
| * a table that already has rows; the rebuild at the end drops `attendee_id` and | ||
| * takes the columns' final form from SCHEMA, which has no default. Each step is | ||
| * skipped when it has already been done, so a re-run after a failed verify is a | ||
| * cheap no-op. | ||
| */ | ||
| export default bareSchemaMigration( | ||
| "2026-07-28_note_entities", | ||
| "Replace system_notes.attendee_id with entity_type + entity_id, so notes can be about any record and not only an attendee. Existing notes become notes about an attendee", | ||
| async ({ getDb, recreateTable, syncIndexes }) => { | ||
| const info = await getDb().execute("PRAGMA table_info(system_notes)"); | ||
| const columns = new Set(info.rows.map((row) => String(row.name))); | ||
| if (!columns.has("attendee_id")) return; | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
|
|
||
| if (!columns.has("entity_type")) { | ||
| await getDb().execute( | ||
| "ALTER TABLE system_notes ADD COLUMN entity_type TEXT NOT NULL DEFAULT 'attendee'", | ||
| ); | ||
| } | ||
| if (!columns.has("entity_id")) { | ||
| await getDb().execute( | ||
| "ALTER TABLE system_notes ADD COLUMN entity_id INTEGER NOT NULL DEFAULT 0", | ||
| ); | ||
| } | ||
| await getDb().execute( | ||
| "UPDATE system_notes SET entity_type = 'attendee', entity_id = attendee_id", | ||
|
stefan-burke marked this conversation as resolved.
Resolved
|
||
| ); | ||
| await recreateTable("system_notes"); // rebuild from SCHEMA, dropping attendee_id | ||
|
stefan-burke marked this conversation as resolved.
Resolved
stefan-burke marked this conversation as resolved.
Resolved
|
||
| await syncIndexes(); // idx_system_notes_entity in place of the attendee one | ||
| }, | ||
| ); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.