7 lines
346 B
SQL
7 lines
346 B
SQL
-- One quiz per piece of content. A chapter, lecture or conversation may carry
|
|
-- at most one live quiz; stand-alone quizzes (no path) are unlimited, and a
|
|
-- deleted quiz frees its link for a new one.
|
|
CREATE UNIQUE INDEX IF NOT EXISTS quizzes_one_per_target
|
|
ON quizzes (target_path)
|
|
WHERE deleted_at IS NULL AND target_path IS NOT NULL;
|