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:
@@ -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`);
|
||||
|
||||
Reference in New Issue
Block a user