try create a database

This commit is contained in:
polv committed 2021-10-17 09:36:24 +07:00
1 parent 0908e51791
commit 792fa60030
19 files changed
+112 -22

No files matched your search

Regular → Executable
+7 -7
View File
@@ -45,14 +45,14 @@ CREATE TABLE "entry.reading" (
"id" UUID NOT NULL PRIMARY KEY DEFAULT uuid_generate_v4(),
"createdAt" TIMESTAMPTZ DEFAULT now(),
"updatedAt" TIMESTAMPTZ DEFAULT now(),
"userId" UUID REFERENCES "user"("id") ON DELETE CASCADE,
"entryId" UUID REFERENCES "entry"("id") ON DELETE CASCADE
"userId" UUID NOT NULL REFERENCES "user"("id") ON DELETE CASCADE,
"entryId" UUID NOT NULL REFERENCES "entry"("id") ON DELETE CASCADE,
"type" TEXT NOT NULL,
"reading" TEXT[] NOT NULL DEFAULT '{}' CHECK ("reading"[1] IS NOT NULL)
);
CREATE INDEX "idx_entry.reading_updatedAt" ON "entry.reading" ("updatedAt");
CREATE INDEX "idx_entry.reading_userId" ON "entry.reading" ("userId")
CREATE INDEX "idx_entry.reading_userId" ON "entry.reading" ("userId");
CREATE INDEX "idx_entry.reading_type" ON "entry.reading" ("type");
CREATE INDEX "idx_entry.reading_reading" ON "entry.reading"
USING pgroonga (normalize_reading("reading"))
@@ -65,15 +65,15 @@ CREATE TABLE "entry.translation" (
"id" UUID NOT NULL PRIMARY KEY DEFAULT uuid_generate_v4(),
"createdAt" TIMESTAMPTZ DEFAULT now(),
"updatedAt" TIMESTAMPTZ DEFAULT now(),
"userId" UUID REFERENCES "user"("id") ON DELETE CASCADE,
"entryId" UUID REFERENCES "entry"("id") ON DELETE CASCADE
"userId" UUID NOT NULL REFERENCES "user"("id") ON DELETE CASCADE,
"entryId" UUID NOT NULL REFERENCES "entry"("id") ON DELETE CASCADE,
"language" TEXT NOT NULL,
"translation" TEXT[] NOT NULL DEFAULT '{}' CHECK ("translation"[1] IS NOT NULL)
);
CREATE INDEX "idx_entry.translation_updatedAt" ON "entry.translation" ("updatedAt");
CREATE INDEX "idx_entry.translation_userId" ON "entry.translation" ("userId")
CREATE INDEX "idx_entry.translation_language" ON "entry.trnalsation" ("language");
CREATE INDEX "idx_entry.translation_userId" ON "entry.translation" ("userId");
CREATE INDEX "idx_entry.translation_language" ON "entry.translation" ("language");
CREATE INDEX "idx_entry.translation_translation" ON "entry.translation"
USING pgroonga("translation")
WITH (plugins='token_filters/stem', token_filters='TokenFilterStem');