KamoCRM

Move notes from account ownership onto membership

FeatureInitializerService
Shipped
14 ஆகஸ்ட், 2026 அன்று 11:07 PM UTC
Author
Kamo
Commit
efa2ebb

Adds notes.member_id and attaches each note to its owner's earliest membership — the organisation the account has belonged to longest, which in practice is where the notes were written. A note therefore lands in exactly one organisation rather than being duplicated into all of them; the count of accounts for which that choice was material is logged, because for them the notes stop being visible from their other orgs. @Order(0) for the reason every column-add runner is: once the shared-lib entity maps MEMBER_ID, any runner that loads a Note emits the column in its SELECT, and a migration ordered late would never be reached. The column arrives nullable — notes is populated and YugabyteDB rejects ADD COLUMN ... NOT NULL on such a table — and its default is dropped explicitly. An inherited unique_rowid() would stamp every existing note with a member id matching no row, which the backfill would then skip as already placed, hiding every note in the system at once. Run against production: column added, 3 note(s) placed, none unplaced.

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing