12 lines
No EOL
753 B
SQL
12 lines
No EOL
753 B
SQL
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"); |