feat: pairs answer_type TEXT[], statements.answer bool

- pairs: answer_type changed from VARCHAR(20) to TEXT[] (multi-value)
  POST/PATCH now accept arrays like ['text','yes_no','word']
- statements: add answer BOOLEAN (nullable) for yes/no correct answer
- migration: ALTER TABLE pairs + ADD COLUMN statements.answer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-24 20:48:29 +02:00
parent 5411e478cb
commit 7c8d5bfaaf
3 changed files with 29 additions and 9 deletions

View File

@@ -319,6 +319,16 @@ async function migrate() {
)
`);
// pairs.answer_type → TEXT[] (multi-select)
await query(`ALTER TABLE pairs DROP CONSTRAINT IF EXISTS pairs_answer_type_check`).catch(() => {});
await query(`
ALTER TABLE pairs ALTER COLUMN answer_type TYPE TEXT[]
USING ARRAY[answer_type]::TEXT[]
`).catch(() => {});
// statements.answer — boolean nullable (for yes/no correct answer)
await query(`ALTER TABLE statements ADD COLUMN IF NOT EXISTS answer BOOLEAN`);
// objects_created on pictures
await query(`ALTER TABLE pictures ADD COLUMN IF NOT EXISTS objects_created BOOLEAN NOT NULL DEFAULT false`);
await query(`ALTER TABLE pictures ADD COLUMN IF NOT EXISTS objects_created_at TIMESTAMPTZ`);