feat(db): add incremental upsert seed script for WordNet vocabulary

Implements packages/db/src/seed.ts — reads all JSON files from
scripts/datafiles/, validates filenames against supported language
codes and POS, and upserts synsets into  and
via onConflictDoNothing. Safe to re-run; produces 0 writes on
a duplicate run.
This commit is contained in:
lila 2026-03-30 15:58:01 +02:00
parent 55885336ba
commit 2b177aad5b
12 changed files with 1349 additions and 10 deletions

View file

@ -6,7 +6,7 @@
- add this to drizzle migrartions file:
✅ ALTER TABLE terms ADD CHECK (pos IN ('noun', 'verb', 'adjective', etc));
## open word net
## openwordnet
download libraries via
@ -45,3 +45,17 @@ list all libraries:
```bash
python -c "import wn; print(wn.lexicons())"
```
## drizzle
generate migration file, go to packages/db, then:
```bash
pnpm drizzle-kit generate
```
execute migration, go to packages/db (docker containers need to be running):
```bash
DATABASE_URL=postgresql://username:password@localhost:5432/database pnpm drizzle-kit migrate
```