adding term examples table
This commit is contained in:
parent
e718d188d5
commit
0ac2cef6e1
4 changed files with 1228 additions and 0 deletions
12
packages/db/drizzle/0008_far_energizer.sql
Normal file
12
packages/db/drizzle/0008_far_energizer.sql
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
CREATE TABLE "term_examples" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"term_id" uuid NOT NULL,
|
||||
"language_code" varchar(10) NOT NULL,
|
||||
"text" text NOT NULL,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "unique_term_example" UNIQUE("term_id","language_code","text"),
|
||||
CONSTRAINT "language_code_check" CHECK ("term_examples"."language_code" IN ('en', 'it', 'de', 'fr', 'es'))
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "term_examples" ADD CONSTRAINT "term_examples_term_id_terms_id_fk" FOREIGN KEY ("term_id") REFERENCES "public"."terms"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE INDEX "idx_term_examples_term_id" ON "term_examples" USING btree ("term_id","language_code");
|
||||
Loading…
Add table
Add a link
Reference in a new issue