Creator operations persistence
SqlCreatorStore implements canonical creator records, immutable agreements, accruals and ledger entries using the existing DatabaseProvider transaction port. The host owns connection configuration, schema migration and runtime database roles.
Call migrate() through the host migration workflow. State is placed in the private
creator_operations schema. Workspace-level row locks serialize financial mutations; record revision checks and history updates commit together. Compound unique indexes protect accepted terms, observation accruals and ledger sources.
Wallet availability subtracts paid debits and all reserved/submitting/unknown payouts. Mixed currency or scale totals are never combined. The adapter has no provider calls, secrets, public Data API routes or authority defaults. Production payout rails and Hirly data migration require separate qualification.
SqlCreatorTrainingStore implements scope/creator-serialized training state and immutable request receipts through the library-owned DatabaseProvider. State and receipt commit together; creator/course identity is preserved and version conflicts fail. Migrate the training tables before installing CreatorTrainingService. Existing Hirly tables are not read or mutated by this adapter.
CreatorTrainingSnapshotImporter supports additive migration rehearsals using authorized exports. Migrate the training store first. Imported snapshots retain progress, timestamps and versions; divergent existing state is rejected. Replaying an identical import does not overwrite later updates. Source record/evidence references remain recorded. Legacy request-receipt compatibility must be handled separately before a writer cutover.
importCreatorTrainingLegacyReceipt imports authorized native result-only receipts after state import. It retains source/evidence references, rejects divergence or collision with exact-input receipts, and never invents missing original event payloads. The training service requires explicit native compatibility mode to replay these records.
Training reads verify payload course/version against selected columns and validate creator/request/scope bindings on both exact and legacy receipts. Corrupt or mismatched records fail rather than being replayed as another creator's progress.
The clean marketing consumer check exercises training initialization, quiz updates, exact replay and tenant isolation under Bun and Node using packed files and real SQL. Its authorization fixture is simulated; production enrollment remains host-owned.
SqlCreatorQuizAttemptStore persists private server-scored attempt receipts. Concurrent identical attempts preserve the first scoring timestamp; changed answers, result or key evidence under the same scoped attempt ID are rejected. Reads validate scope and result consistency. Authorization and trusted answer-key loading remain service responsibilities.