-- +goose Up CREATE TABLE IF NOT EXISTS team_answers ( id SERIAL PRIMARY KEY, team_id INTEGER NOT NULL, question_code TEXT NOT NULL, answer TEXT NOT NULL DEFAULT '', score INTEGER, created_at TIMESTAMP NOT NULL DEFAULT NOW (), updated_at TIMESTAMP NOT NULL DEFAULT NOW (), CONSTRAINT fk_team_answers_team FOREIGN KEY (team_id) REFERENCES teams (id) ON DELETE CASCADE, CONSTRAINT uq_team_answer UNIQUE (team_id, question_code) ); -- +goose Down DROP TABLE IF EXISTS team_answers;