13 lines
611 B
SQL
13 lines
611 B
SQL
-- Store learner audio answer submissions for AUDIO-type questions
|
|
CREATE TABLE IF NOT EXISTS user_audio_responses (
|
|
id BIGSERIAL PRIMARY KEY,
|
|
user_id BIGINT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
|
question_id BIGINT NOT NULL REFERENCES questions(id) ON DELETE CASCADE,
|
|
question_set_id BIGINT NOT NULL REFERENCES question_sets(id) ON DELETE CASCADE,
|
|
audio_object_key TEXT NOT NULL,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_user_audio_responses_user_question
|
|
ON user_audio_responses(user_id, question_id, question_set_id);
|