reviewing and updating deck generation

This commit is contained in:
lila 2026-03-31 16:48:40 +02:00
parent 521ffe3b6e
commit 9d1a82bdf0
5 changed files with 10 additions and 51 deletions

View file

@ -1,34 +0,0 @@
a
other
us
may
st
paul
new
software
oxford
english
mary
japan
while
pp
membership
manchester
tony
alan
jones
un
northern
simon
behalf
co
graham
joe
guy
lewis
jane
taylor
co-operation
travel
self
thatcher

View file

@ -7,7 +7,6 @@ import {
unique,
check,
boolean,
integer,
primaryKey,
index,
} from "drizzle-orm/pg-core";
@ -133,19 +132,19 @@ export const decks = pgTable(
id: uuid().primaryKey().defaultRandom(),
name: text().notNull(),
description: text(),
language_pair_id: uuid()
validated_for_languages: varchar({ length: 10 })
.array()
.notNull()
.references(() => language_pairs.id, { onDelete: "cascade" }),
created_by: uuid()
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
.default([]),
is_public: boolean().default(false).notNull(),
created_at: timestamp({ withTimezone: true }).defaultNow().notNull(),
},
(table) => [
unique("unique_deck_name").on(table.name, table.created_by),
index("idx_decks_created_by").on(table.created_by),
index("idx_decks_language_pair").on(table.language_pair_id),
check(
"validated_languages_check",
sql`validated_for_languages <@ ARRAY[${sql.raw(SUPPORTED_LANGUAGE_CODES.map((l) => `'${l}'`).join(", "))}]::varchar[]`,
),
unique("unique_deck_name").on(table.name),
],
);
@ -158,7 +157,6 @@ export const deck_terms = pgTable(
term_id: uuid()
.notNull()
.references(() => terms.id, { onDelete: "cascade" }),
position: integer().notNull(),
added_at: timestamp({ withTimezone: true }).defaultNow().notNull(),
},
(table) => [

View file

@ -16,7 +16,7 @@ Close the DB connection
import fs from "node:fs/promises";
import { db } from "@glossa/db";
import { translations } from "@glossa/db/schema";
import { inArray, and, eq } from "drizzle-orm";
import { inArray } from "drizzle-orm";
const wordlistPath = "./src/data/wordlists/top1000englishnouns";

View file

@ -1,5 +0,0 @@
import { db } from "./index.js";
const result = await db.execute("select 1");
console.log("result: ", result);