cyberhybridhub/server/migrations/020_spelling_question_links.sql
nathanAndrinoid 4459852f83
Some checks failed
Admin portal tests / test (push) Has been cancelled
spelling
2026-06-05 03:22:35 +00:00

15 lines
659 B
SQL

-- Links a spelling quiz question row to the selected catalog item at tile load.
CREATE TABLE IF NOT EXISTS spelling_question_links (
question_id UUID PRIMARY KEY REFERENCES questions (id) ON DELETE CASCADE,
firebase_uid TEXT NOT NULL REFERENCES users (firebase_uid) ON DELETE CASCADE,
spelling_item_id UUID NOT NULL REFERENCES spelling_items (id) ON DELETE CASCADE,
linked_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS spelling_question_links_uid_idx
ON spelling_question_links (firebase_uid);
CREATE INDEX IF NOT EXISTS spelling_question_links_item_idx
ON spelling_question_links (spelling_item_id);