reviewing and updating deck generation
This commit is contained in:
parent
521ffe3b6e
commit
9d1a82bdf0
5 changed files with 10 additions and 51 deletions
|
|
@ -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) => [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue