From 63f27e8e13b83fcfdfe19f4fcc8b2c76df6c9e45 Mon Sep 17 00:00:00 2001 From: lila Date: Fri, 24 Jul 2026 00:23:56 +0200 Subject: [PATCH] Add words, senses, translations schema migration --- .../db/drizzle/0012_graceful_psynapse.sql | 46 + packages/db/drizzle/meta/0012_snapshot.json | 1049 +++++++++++++++++ packages/db/drizzle/meta/_journal.json | 7 + 3 files changed, 1102 insertions(+) create mode 100644 packages/db/drizzle/0012_graceful_psynapse.sql create mode 100644 packages/db/drizzle/meta/0012_snapshot.json diff --git a/packages/db/drizzle/0012_graceful_psynapse.sql b/packages/db/drizzle/0012_graceful_psynapse.sql new file mode 100644 index 0000000..908e6a1 --- /dev/null +++ b/packages/db/drizzle/0012_graceful_psynapse.sql @@ -0,0 +1,46 @@ +CREATE TABLE "senses" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "word_id" uuid NOT NULL, + "sense_index" smallint DEFAULT 0 NOT NULL, + "difficulty" varchar(20) NOT NULL, + "definitions" text[] DEFAULT '{}' NOT NULL, + "examples" text[] DEFAULT '{}' NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + CONSTRAINT "unique_sense_per_word" UNIQUE("word_id","sense_index"), + CONSTRAINT "senses_difficulty_check" CHECK ("senses"."difficulty" IN ('easy', 'medium', 'hard')) +); +--> statement-breakpoint +CREATE TABLE "translations" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "sense_id" uuid NOT NULL, + "target_language_code" varchar(10) NOT NULL, + "translation" text NOT NULL, + "gender" varchar(20), + "difficulty" varchar(20) NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + CONSTRAINT "unique_translation_per_sense" UNIQUE("sense_id","target_language_code","translation"), + CONSTRAINT "translations_language_code_check" CHECK ("translations"."target_language_code" IN ('en', 'it', 'de', 'fr', 'es')), + CONSTRAINT "translations_difficulty_check" CHECK ("translations"."difficulty" IN ('easy', 'medium', 'hard')), + CONSTRAINT "translations_gender_check" CHECK ("translations"."gender" IS NULL OR "translations"."gender" IN ('masculine', 'feminine', 'neuter')) +); +--> statement-breakpoint +CREATE TABLE "words" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "headword" text NOT NULL, + "language_code" varchar(10) NOT NULL, + "pos" varchar(20) NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + CONSTRAINT "unique_word_per_language_and_pos" UNIQUE("headword","language_code","pos"), + CONSTRAINT "words_language_code_check" CHECK ("words"."language_code" IN ('en', 'it', 'de', 'fr', 'es')), + CONSTRAINT "words_pos_check" CHECK ("words"."pos" IN ('noun', 'verb', 'adjective', 'adverb')) +); +--> statement-breakpoint +ALTER TABLE "entry_translations" DROP CONSTRAINT "difficulty_check";--> statement-breakpoint +ALTER TABLE "vocabulary_entries" DROP CONSTRAINT "difficulty_check";--> statement-breakpoint +ALTER TABLE "senses" ADD CONSTRAINT "senses_word_id_words_id_fk" FOREIGN KEY ("word_id") REFERENCES "public"."words"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "translations" ADD CONSTRAINT "translations_sense_id_senses_id_fk" FOREIGN KEY ("sense_id") REFERENCES "public"."senses"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +CREATE INDEX "idx_word_sense_difficulty" ON "senses" USING btree ("word_id","difficulty");--> statement-breakpoint +CREATE INDEX "idx_translations_sense_language_difficulty" ON "translations" USING btree ("sense_id","target_language_code","difficulty");--> statement-breakpoint +CREATE INDEX "idx_language_code_pos" ON "words" USING btree ("language_code","pos");--> statement-breakpoint +ALTER TABLE "entry_translations" ADD CONSTRAINT "difficulty_check" CHECK ("entry_translations"."difficulty" IS NULL OR "entry_translations"."difficulty" IN ('easy', 'medium', 'hard'));--> statement-breakpoint +ALTER TABLE "vocabulary_entries" ADD CONSTRAINT "difficulty_check" CHECK ("vocabulary_entries"."difficulty" IS NULL OR "vocabulary_entries"."difficulty" IN ('easy', 'medium', 'hard')); \ No newline at end of file diff --git a/packages/db/drizzle/meta/0012_snapshot.json b/packages/db/drizzle/meta/0012_snapshot.json new file mode 100644 index 0000000..0ee7f41 --- /dev/null +++ b/packages/db/drizzle/meta/0012_snapshot.json @@ -0,0 +1,1049 @@ +{ + "id": "d5f011e9-7ab4-44be-8a81-9e77b900e088", + "prevId": "6f1811a6-8573-4d43-912a-ceb5191341cc", + "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', 'medium', '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.senses": { + "name": "senses", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "word_id": { + "name": "word_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "sense_index": { + "name": "sense_index", + "type": "smallint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "difficulty": { + "name": "difficulty", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "definitions": { + "name": "definitions", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "examples": { + "name": "examples", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{}'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_word_sense_difficulty": { + "name": "idx_word_sense_difficulty", + "columns": [ + { + "expression": "word_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "difficulty", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "senses_word_id_words_id_fk": { + "name": "senses_word_id_words_id_fk", + "tableFrom": "senses", + "tableTo": "words", + "columnsFrom": ["word_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "unique_sense_per_word": { + "name": "unique_sense_per_word", + "nullsNotDistinct": false, + "columns": ["word_id", "sense_index"] + } + }, + "policies": {}, + "checkConstraints": { + "senses_difficulty_check": { + "name": "senses_difficulty_check", + "value": "\"senses\".\"difficulty\" IN ('easy', 'medium', 'hard')" + } + }, + "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.translations": { + "name": "translations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "sense_id": { + "name": "sense_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 + }, + "gender": { + "name": "gender", + "type": "varchar(20)", + "primaryKey": false, + "notNull": false + }, + "difficulty": { + "name": "difficulty", + "type": "varchar(20)", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_translations_sense_language_difficulty": { + "name": "idx_translations_sense_language_difficulty", + "columns": [ + { + "expression": "sense_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "target_language_code", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "difficulty", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "translations_sense_id_senses_id_fk": { + "name": "translations_sense_id_senses_id_fk", + "tableFrom": "translations", + "tableTo": "senses", + "columnsFrom": ["sense_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "unique_translation_per_sense": { + "name": "unique_translation_per_sense", + "nullsNotDistinct": false, + "columns": ["sense_id", "target_language_code", "translation"] + } + }, + "policies": {}, + "checkConstraints": { + "translations_language_code_check": { + "name": "translations_language_code_check", + "value": "\"translations\".\"target_language_code\" IN ('en', 'it', 'de', 'fr', 'es')" + }, + "translations_difficulty_check": { + "name": "translations_difficulty_check", + "value": "\"translations\".\"difficulty\" IN ('easy', 'medium', 'hard')" + }, + "translations_gender_check": { + "name": "translations_gender_check", + "value": "\"translations\".\"gender\" IS NULL OR \"translations\".\"gender\" IN ('masculine', 'feminine', 'neuter')" + } + }, + "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', 'medium', 'hard')" + } + }, + "isRLSEnabled": false + }, + "public.words": { + "name": "words", + "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 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "idx_language_code_pos": { + "name": "idx_language_code_pos", + "columns": [ + { + "expression": "language_code", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "pos", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "unique_word_per_language_and_pos": { + "name": "unique_word_per_language_and_pos", + "nullsNotDistinct": false, + "columns": ["headword", "language_code", "pos"] + } + }, + "policies": {}, + "checkConstraints": { + "words_language_code_check": { + "name": "words_language_code_check", + "value": "\"words\".\"language_code\" IN ('en', 'it', 'de', 'fr', 'es')" + }, + "words_pos_check": { + "name": "words_pos_check", + "value": "\"words\".\"pos\" IN ('noun', 'verb', 'adjective', 'adverb')" + } + }, + "isRLSEnabled": false + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { "columns": {}, "schemas": {}, "tables": {} } +} diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json index cc6836e..6949fba 100644 --- a/packages/db/drizzle/meta/_journal.json +++ b/packages/db/drizzle/meta/_journal.json @@ -85,6 +85,13 @@ "when": 1777994750330, "tag": "0011_nice_spyke", "breakpoints": true + }, + { + "idx": 12, + "version": "7", + "when": 1784844527683, + "tag": "0012_graceful_psynapse", + "breakpoints": true } ] }