- Drizzle (postgres-js) setup: schema (quiz_category, quiz_question, quiz_played, game_history), client (nullable — no DATABASE_URL → null), drizzle.config, initial migration, migrate script - Open Trivia DB seed: curated geek categories, mcq + truefalse, base64 decode (incl. type/difficulty), 1 req/5s rate limit, idempotent (prompt unique); also seeds the FR in-code bank as source 'manual' - quiz wired to the DB: per-room pool preloaded at game start (loadQuizPool excludes already-played), records quiz_played for cross-session anti-repeat; falls back to the in-code bank when no DB - docker-compose for local Postgres; db:* scripts; DATABASE_URL in env Roadmap V1 step 5. Verified against a real Postgres: migrate + seed (270 OpenTDB + 10 manual), DB-backed game serves OpenTDB questions and fills quiz_played; no-DB fallback still serves the in-code bank. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
263 lines
No EOL
6.4 KiB
JSON
263 lines
No EOL
6.4 KiB
JSON
{
|
|
"id": "c68e2f59-3d1b-4fca-8443-17fe243e2919",
|
|
"prevId": "00000000-0000-0000-0000-000000000000",
|
|
"version": "7",
|
|
"dialect": "postgresql",
|
|
"tables": {
|
|
"public.game_history": {
|
|
"name": "game_history",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"room_code": {
|
|
"name": "room_code",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"played_at": {
|
|
"name": "played_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"modes": {
|
|
"name": "modes",
|
|
"type": "jsonb",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"results": {
|
|
"name": "results",
|
|
"type": "jsonb",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.quiz_category": {
|
|
"name": "quiz_category",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"name": {
|
|
"name": "name",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {
|
|
"quiz_category_name_unique": {
|
|
"name": "quiz_category_name_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": [
|
|
"name"
|
|
]
|
|
}
|
|
},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.quiz_played": {
|
|
"name": "quiz_played",
|
|
"schema": "",
|
|
"columns": {
|
|
"question_id": {
|
|
"name": "question_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"room_code": {
|
|
"name": "room_code",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"played_at": {
|
|
"name": "played_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {
|
|
"quiz_played_question_id_quiz_question_id_fk": {
|
|
"name": "quiz_played_question_id_quiz_question_id_fk",
|
|
"tableFrom": "quiz_played",
|
|
"tableTo": "quiz_question",
|
|
"columnsFrom": [
|
|
"question_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "no action",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {
|
|
"quiz_played_question_id_room_code_pk": {
|
|
"name": "quiz_played_question_id_room_code_pk",
|
|
"columns": [
|
|
"question_id",
|
|
"room_code"
|
|
]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.quiz_question": {
|
|
"name": "quiz_question",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"category_id": {
|
|
"name": "category_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"format": {
|
|
"name": "format",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"prompt": {
|
|
"name": "prompt",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"difficulty": {
|
|
"name": "difficulty",
|
|
"type": "integer",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": 1
|
|
},
|
|
"source": {
|
|
"name": "source",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"choices": {
|
|
"name": "choices",
|
|
"type": "jsonb",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"correct_index": {
|
|
"name": "correct_index",
|
|
"type": "integer",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"accepted_answers": {
|
|
"name": "accepted_answers",
|
|
"type": "jsonb",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"image_url": {
|
|
"name": "image_url",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {
|
|
"quiz_question_category_id_quiz_category_id_fk": {
|
|
"name": "quiz_question_category_id_quiz_category_id_fk",
|
|
"tableFrom": "quiz_question",
|
|
"tableTo": "quiz_category",
|
|
"columnsFrom": [
|
|
"category_id"
|
|
],
|
|
"columnsTo": [
|
|
"id"
|
|
],
|
|
"onDelete": "no action",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {
|
|
"quiz_question_prompt_unique": {
|
|
"name": "quiz_question_prompt_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": [
|
|
"prompt"
|
|
]
|
|
}
|
|
},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
}
|
|
},
|
|
"enums": {},
|
|
"schemas": {},
|
|
"sequences": {},
|
|
"roles": {},
|
|
"policies": {},
|
|
"views": {},
|
|
"_meta": {
|
|
"columns": {},
|
|
"schemas": {},
|
|
"tables": {}
|
|
}
|
|
} |