15 lines
659 B
SQL
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);
|