See the best posts from any Bluesky account
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Drop composite isPrimary on NotifiedThreshold model

Lucid's BaseModel doesn't genuinely support composite primary keys — marking
both subject_uri and threshold as isPrimary is cosmetic and makes reload,
$primaryKeyValue, and .find() behave surprisingly. Keep only subject_uri as
the Lucid-level primary key; the SQLite composite PK (enforced by the
migration) still guarantees uniqueness.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+1 -5
+1 -5
app/models/notified_threshold.ts
··· 3 3 /** 4 4 * Per-(post, threshold) dedup row so the firehose threshold-scan job only 5 5 * fires a Discord webhook the first time a post crosses each threshold. 6 - * 7 - * Composite primary key on (subject_uri, threshold) — Lucid supports this 8 - * by marking both columns as `isPrimary`. Queries that need to load a row 9 - * should use `.query().where(...).first()` rather than `findOrFail(...)`. 10 6 */ 11 7 export default class NotifiedThreshold extends BaseModel { 12 8 static table = 'notified_thresholds' ··· 15 11 @column({ isPrimary: true }) 16 12 declare subjectUri: string 17 13 18 - @column({ isPrimary: true }) 14 + @column() 19 15 declare threshold: number 20 16 21 17 @column()