This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
-- Durable replay and non-repeatable-completion guards for atomic SBC submissions.
|
||||
-- Existing successful rows are treated as non-repeatable; if historical data already
|
||||
-- violates that invariant the migration fails rather than silently discarding history.
|
||||
ALTER TABLE sbc_submissions ADD COLUMN repeatable INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
CREATE UNIQUE INDEX idx_sbc_nonrepeatable_completion
|
||||
ON sbc_submissions(profile_id, sbc_id)
|
||||
WHERE passed = 1 AND repeatable = 0;
|
||||
|
||||
-- submitted_card_ids is stored in canonical sorted order by the writer. This rejects
|
||||
-- stale retries of the same card set even for explicitly repeatable challenges.
|
||||
CREATE UNIQUE INDEX idx_sbc_submission_replay
|
||||
ON sbc_submissions(profile_id, sbc_id, submitted_card_ids)
|
||||
WHERE passed = 1;
|
||||
@@ -0,0 +1,9 @@
|
||||
-- Core owns durable per-profile working squads for SBC challenges. The FIFA17
|
||||
-- adapter maps its numeric challenge id to the opaque generic sbc_id.
|
||||
CREATE TABLE sbc_challenge_squads (
|
||||
profile_id TEXT NOT NULL REFERENCES profiles(id),
|
||||
sbc_id TEXT NOT NULL,
|
||||
owned_card_ids TEXT NOT NULL,
|
||||
updated_at TEXT NOT NULL,
|
||||
PRIMARY KEY (profile_id, sbc_id)
|
||||
);
|
||||
Reference in New Issue
Block a user