Skip to content

MOS-14: Add PostgreSQL repositories with composite keys and ordering - #18

Merged
timoruohomaki merged 1 commit into
masterfrom
feat/MOS-14-postgres-repositories
Nov 9, 2026
Merged

timoruohomaki merged 1 commit into
masterfrom
feat/MOS-14-postgres-repositories

Conversation

@timoruohomaki

Copy link
Copy Markdown
Contributor
  • Repository interfaces use MOS composite keys (roID/storyID/itemID, mosID/objID) and add Move, Swap and ReplaceAll for stories and items. Order is managed by the repositories; shared ordering rules and ID checks live in repository/order.go. New ErrInvalid.
  • internal/store/postgres: hand-written pgx repositories over a DBTX (pool or transaction). Version-checked running order updates, parent row locks around position changes, single-statement renumbering, and mapping of SQLSTATEs to the repository errors.
  • Contract suite extended: ordering, minimal records, create after delete, composite key independence, cascades incl. ReplaceAll. Runs against the memory store and the test database; plus concurrent append and error mapping tests for PostgreSQL.
  • Model drops fields that belonged to MongoDB-era linking (Previous/ NextID, First/LastStoryID, story Duration) and bson tags.
  • Service: roCreate replaces stories and items in message order; composite keys in story actions; server output drops storyDur and adds item mosID.
  • Docs: migration plan and developer reference updated.

- Repository interfaces use MOS composite keys (roID/storyID/itemID,
  mosID/objID) and add Move, Swap and ReplaceAll for stories and items.
  Order is managed by the repositories; shared ordering rules and ID
  checks live in repository/order.go. New ErrInvalid.
- internal/store/postgres: hand-written pgx repositories over a DBTX
  (pool or transaction). Version-checked running order updates, parent
  row locks around position changes, single-statement renumbering, and
  mapping of SQLSTATEs to the repository errors.
- Contract suite extended: ordering, minimal records, create after
  delete, composite key independence, cascades incl. ReplaceAll. Runs
  against the memory store and the test database; plus concurrent
  append and error mapping tests for PostgreSQL.
- Model drops fields that belonged to MongoDB-era linking (Previous/
  NextID, First/LastStoryID, story Duration) and bson tags.
- Service: roCreate replaces stories and items in message order;
  composite keys in story actions; server output drops storyDur and
  adds item mosID.
- Docs: migration plan and developer reference updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@timoruohomaki
timoruohomaki merged commit 6abc7b3 into master Nov 9, 2026
3 checks passed
@timoruohomaki
timoruohomaki deleted the feat/MOS-14-postgres-repositories branch November 9, 2026 17:39
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.

1 participant