- Replace terms/translations/term_glosses/term_examples with vocabulary_entries and entry_translations - Remove decks, topics and related tables (deferred) - Add cefr_level and difficulty to entry_translations for game query filtering - Update termModel.ts for new schema — getDistractors now takes sourceLanguage - Update gameService.ts and multiplayerGameService.ts for entryId rename - Update all test fixtures from termId to entryId - Generate and apply migration 0011
750 lines
20 KiB
JSON
750 lines
20 KiB
JSON
{
|
|
"id": "6f1811a6-8573-4d43-912a-ceb5191341cc",
|
|
"prevId": "6c1cb049-807d-43d0-b83e-d3575b80de33",
|
|
"version": "7",
|
|
"dialect": "postgresql",
|
|
"tables": {
|
|
"public.account": {
|
|
"name": "account",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "text",
|
|
"primaryKey": true,
|
|
"notNull": true
|
|
},
|
|
"account_id": {
|
|
"name": "account_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"provider_id": {
|
|
"name": "provider_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"access_token": {
|
|
"name": "access_token",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"refresh_token": {
|
|
"name": "refresh_token",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"id_token": {
|
|
"name": "id_token",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"access_token_expires_at": {
|
|
"name": "access_token_expires_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"refresh_token_expires_at": {
|
|
"name": "refresh_token_expires_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"scope": {
|
|
"name": "scope",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"password": {
|
|
"name": "password",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
}
|
|
},
|
|
"indexes": {
|
|
"account_userId_idx": {
|
|
"name": "account_userId_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "user_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"account_user_id_user_id_fk": {
|
|
"name": "account_user_id_user_id_fk",
|
|
"tableFrom": "account",
|
|
"tableTo": "user",
|
|
"columnsFrom": ["user_id"],
|
|
"columnsTo": ["id"],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.entry_translations": {
|
|
"name": "entry_translations",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"entry_id": {
|
|
"name": "entry_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"target_language_code": {
|
|
"name": "target_language_code",
|
|
"type": "varchar(10)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"translation": {
|
|
"name": "translation",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"sense_hint": {
|
|
"name": "sense_hint",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"cefr_level": {
|
|
"name": "cefr_level",
|
|
"type": "varchar(2)",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"difficulty": {
|
|
"name": "difficulty",
|
|
"type": "varchar(20)",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"source": {
|
|
"name": "source",
|
|
"type": "varchar(50)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "'kaikki'"
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"idx_translations_target_lang": {
|
|
"name": "idx_translations_target_lang",
|
|
"columns": [
|
|
{
|
|
"expression": "target_language_code",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
},
|
|
{
|
|
"expression": "difficulty",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
},
|
|
{
|
|
"expression": "entry_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"entry_translations_entry_id_vocabulary_entries_id_fk": {
|
|
"name": "entry_translations_entry_id_vocabulary_entries_id_fk",
|
|
"tableFrom": "entry_translations",
|
|
"tableTo": "vocabulary_entries",
|
|
"columnsFrom": ["entry_id"],
|
|
"columnsTo": ["id"],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {
|
|
"unique_translation": {
|
|
"name": "unique_translation",
|
|
"nullsNotDistinct": false,
|
|
"columns": ["entry_id", "target_language_code", "translation"]
|
|
}
|
|
},
|
|
"policies": {},
|
|
"checkConstraints": {
|
|
"target_language_code_check": {
|
|
"name": "target_language_code_check",
|
|
"value": "\"entry_translations\".\"target_language_code\" IN ('en', 'it', 'de', 'fr', 'es')"
|
|
},
|
|
"cefr_check": {
|
|
"name": "cefr_check",
|
|
"value": "\"entry_translations\".\"cefr_level\" IS NULL OR \"entry_translations\".\"cefr_level\" IN ('A1', 'A2', 'B1', 'B2', 'C1', 'C2')"
|
|
},
|
|
"difficulty_check": {
|
|
"name": "difficulty_check",
|
|
"value": "\"entry_translations\".\"difficulty\" IS NULL OR \"entry_translations\".\"difficulty\" IN ('easy', 'intermediate', 'hard')"
|
|
}
|
|
},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.lobbies": {
|
|
"name": "lobbies",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"code": {
|
|
"name": "code",
|
|
"type": "varchar(10)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"host_user_id": {
|
|
"name": "host_user_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"status": {
|
|
"name": "status",
|
|
"type": "varchar(20)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "'waiting'"
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {
|
|
"lobbies_host_user_id_user_id_fk": {
|
|
"name": "lobbies_host_user_id_user_id_fk",
|
|
"tableFrom": "lobbies",
|
|
"tableTo": "user",
|
|
"columnsFrom": ["host_user_id"],
|
|
"columnsTo": ["id"],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {
|
|
"lobbies_code_unique": {
|
|
"name": "lobbies_code_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": ["code"]
|
|
}
|
|
},
|
|
"policies": {},
|
|
"checkConstraints": {
|
|
"lobby_status_check": {
|
|
"name": "lobby_status_check",
|
|
"value": "\"lobbies\".\"status\" IN ('waiting', 'in_progress', 'finished')"
|
|
}
|
|
},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.lobby_players": {
|
|
"name": "lobby_players",
|
|
"schema": "",
|
|
"columns": {
|
|
"lobby_id": {
|
|
"name": "lobby_id",
|
|
"type": "uuid",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"score": {
|
|
"name": "score",
|
|
"type": "integer",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": 0
|
|
},
|
|
"joined_at": {
|
|
"name": "joined_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {
|
|
"lobby_players_lobby_id_lobbies_id_fk": {
|
|
"name": "lobby_players_lobby_id_lobbies_id_fk",
|
|
"tableFrom": "lobby_players",
|
|
"tableTo": "lobbies",
|
|
"columnsFrom": ["lobby_id"],
|
|
"columnsTo": ["id"],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
},
|
|
"lobby_players_user_id_user_id_fk": {
|
|
"name": "lobby_players_user_id_user_id_fk",
|
|
"tableFrom": "lobby_players",
|
|
"tableTo": "user",
|
|
"columnsFrom": ["user_id"],
|
|
"columnsTo": ["id"],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {
|
|
"lobby_players_lobby_id_user_id_pk": {
|
|
"name": "lobby_players_lobby_id_user_id_pk",
|
|
"columns": ["lobby_id", "user_id"]
|
|
}
|
|
},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.session": {
|
|
"name": "session",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "text",
|
|
"primaryKey": true,
|
|
"notNull": true
|
|
},
|
|
"expires_at": {
|
|
"name": "expires_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"token": {
|
|
"name": "token",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"ip_address": {
|
|
"name": "ip_address",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"user_agent": {
|
|
"name": "user_agent",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"user_id": {
|
|
"name": "user_id",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
}
|
|
},
|
|
"indexes": {
|
|
"session_userId_idx": {
|
|
"name": "session_userId_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "user_id",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {
|
|
"session_user_id_user_id_fk": {
|
|
"name": "session_user_id_user_id_fk",
|
|
"tableFrom": "session",
|
|
"tableTo": "user",
|
|
"columnsFrom": ["user_id"],
|
|
"columnsTo": ["id"],
|
|
"onDelete": "cascade",
|
|
"onUpdate": "no action"
|
|
}
|
|
},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {
|
|
"session_token_unique": {
|
|
"name": "session_token_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": ["token"]
|
|
}
|
|
},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.user": {
|
|
"name": "user",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "text",
|
|
"primaryKey": true,
|
|
"notNull": true
|
|
},
|
|
"name": {
|
|
"name": "name",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"email_verified": {
|
|
"name": "email_verified",
|
|
"type": "boolean",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": false
|
|
},
|
|
"image": {
|
|
"name": "image",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {
|
|
"user_email_unique": {
|
|
"name": "user_email_unique",
|
|
"nullsNotDistinct": false,
|
|
"columns": ["email"]
|
|
}
|
|
},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.verification": {
|
|
"name": "verification",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "text",
|
|
"primaryKey": true,
|
|
"notNull": true
|
|
},
|
|
"identifier": {
|
|
"name": "identifier",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"value": {
|
|
"name": "value",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"expires_at": {
|
|
"name": "expires_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
},
|
|
"updated_at": {
|
|
"name": "updated_at",
|
|
"type": "timestamp",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"verification_identifier_idx": {
|
|
"name": "verification_identifier_idx",
|
|
"columns": [
|
|
{
|
|
"expression": "identifier",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {},
|
|
"policies": {},
|
|
"checkConstraints": {},
|
|
"isRLSEnabled": false
|
|
},
|
|
"public.vocabulary_entries": {
|
|
"name": "vocabulary_entries",
|
|
"schema": "",
|
|
"columns": {
|
|
"id": {
|
|
"name": "id",
|
|
"type": "uuid",
|
|
"primaryKey": true,
|
|
"notNull": true,
|
|
"default": "gen_random_uuid()"
|
|
},
|
|
"headword": {
|
|
"name": "headword",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"language_code": {
|
|
"name": "language_code",
|
|
"type": "varchar(10)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"pos": {
|
|
"name": "pos",
|
|
"type": "varchar(20)",
|
|
"primaryKey": false,
|
|
"notNull": true
|
|
},
|
|
"sense_index": {
|
|
"name": "sense_index",
|
|
"type": "smallint",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": 0
|
|
},
|
|
"gloss": {
|
|
"name": "gloss",
|
|
"type": "text",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"examples": {
|
|
"name": "examples",
|
|
"type": "text[]",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "'{}'"
|
|
},
|
|
"cefr_level": {
|
|
"name": "cefr_level",
|
|
"type": "varchar(2)",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"difficulty": {
|
|
"name": "difficulty",
|
|
"type": "varchar(20)",
|
|
"primaryKey": false,
|
|
"notNull": false
|
|
},
|
|
"source": {
|
|
"name": "source",
|
|
"type": "varchar(50)",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "'kaikki'"
|
|
},
|
|
"created_at": {
|
|
"name": "created_at",
|
|
"type": "timestamp with time zone",
|
|
"primaryKey": false,
|
|
"notNull": true,
|
|
"default": "now()"
|
|
}
|
|
},
|
|
"indexes": {
|
|
"idx_entries_lang_pos": {
|
|
"name": "idx_entries_lang_pos",
|
|
"columns": [
|
|
{
|
|
"expression": "language_code",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
},
|
|
{
|
|
"expression": "pos",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
},
|
|
{
|
|
"expression": "difficulty",
|
|
"isExpression": false,
|
|
"asc": true,
|
|
"nulls": "last"
|
|
}
|
|
],
|
|
"isUnique": false,
|
|
"concurrently": false,
|
|
"method": "btree",
|
|
"with": {}
|
|
}
|
|
},
|
|
"foreignKeys": {},
|
|
"compositePrimaryKeys": {},
|
|
"uniqueConstraints": {
|
|
"unique_entry": {
|
|
"name": "unique_entry",
|
|
"nullsNotDistinct": false,
|
|
"columns": ["headword", "language_code", "pos", "sense_index"]
|
|
}
|
|
},
|
|
"policies": {},
|
|
"checkConstraints": {
|
|
"language_code_check": {
|
|
"name": "language_code_check",
|
|
"value": "\"vocabulary_entries\".\"language_code\" IN ('en', 'it', 'de', 'fr', 'es')"
|
|
},
|
|
"pos_check": {
|
|
"name": "pos_check",
|
|
"value": "\"vocabulary_entries\".\"pos\" IN ('noun', 'verb', 'adjective', 'adverb')"
|
|
},
|
|
"cefr_check": {
|
|
"name": "cefr_check",
|
|
"value": "\"vocabulary_entries\".\"cefr_level\" IS NULL OR \"vocabulary_entries\".\"cefr_level\" IN ('A1', 'A2', 'B1', 'B2', 'C1', 'C2')"
|
|
},
|
|
"difficulty_check": {
|
|
"name": "difficulty_check",
|
|
"value": "\"vocabulary_entries\".\"difficulty\" IS NULL OR \"vocabulary_entries\".\"difficulty\" IN ('easy', 'intermediate', 'hard')"
|
|
}
|
|
},
|
|
"isRLSEnabled": false
|
|
}
|
|
},
|
|
"enums": {},
|
|
"schemas": {},
|
|
"sequences": {},
|
|
"roles": {},
|
|
"policies": {},
|
|
"views": {},
|
|
"_meta": { "columns": {}, "schemas": {}, "tables": {} }
|
|
}
|