Skip to content

v4: add direct SQLite storage core - #43

Merged
Phloraxx merged 5 commits into
mainfrom
v4/sqlite-core
Sep 1, 2026
Merged

v4: add direct SQLite storage core#43
Phloraxx merged 5 commits into
mainfrom
v4/sqlite-core

Conversation

@Phloraxx

@Phloraxx Phloraxx commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Scope

First PayGate v4 implementation slice. This is isolated code under internal/v4/storage; it is not wired into the production runtime.

Adds

  • direct database/sql + modernc.org/sqlite open/configuration
  • WAL, synchronous=FULL, foreign keys, bounded busy timeout, DQS disabled
  • explicit WithImmediateTx for payment-critical writes only; ordinary read transactions do not acquire the writer lock
  • v4 STRICT schema and schema migration table
  • DB-enforced one-active-profile invariant
  • DB-enforced one-enabled-relay-device invariant
  • DB-enforced active (profile,payable_amount) reservation uniqueness while retaining history
  • non-unique name/event external_id
  • scoped idempotency keys
  • relay events/observations, payment history, webhook outbox, admin/API/session/settings tables
  • JSON/status/amount/foreign-key checks

Validation

Focused unit tests, race tests and go vet pass locally. Added a regression proving an ordinary read transaction can remain open while an explicit immediate write transaction proceeds under WAL.

Safety

No existing PocketBase service, route, migration or production DB path is changed.

@Phloraxx
Phloraxx changed the base branch from plan/v4-unified-paygate to main September 1, 2026 03:43
@Phloraxx
Phloraxx marked this pull request as ready for review September 1, 2026 05:16
@Phloraxx
Phloraxx merged commit 6fbeff2 into main Sep 1, 2026
1 check passed
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