try create a database
This commit is contained in:
1 parent
0908e51791
commit
792fa60030
19 files changed
+112
-22
No files matched your search
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Executable
+15
@@ -0,0 +1,15 @@
|
||||
CREATE TABLE "wanikani.subjects" (
|
||||
"id" INT PRIMARY KEY NOT NULL,
|
||||
"updatedAt" TIMESTAMPTZ NOT NULL,
|
||||
"object" TEXT NOT NULL,
|
||||
"url" TEXT NOT NULL,
|
||||
"data" JSONB NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX "idx_wanikani.subjects_object" ON "wanikani.subjects" ("object");
|
||||
CREATE INDEX "idx_wanikani.subjects_data" ON "wanikani.subjects"
|
||||
USING pgroonga("data")
|
||||
WITH (
|
||||
tokenizer='TokenMecab',
|
||||
normalizer='NormalizerNFKC100("unify_kana", true)'
|
||||
);
|
||||
Regular → Executable
+2
-2
@@ -4,7 +4,7 @@ CREATE TABLE "user" (
|
||||
"updatedAt" TIMESTAMPTZ DEFAULT now(),
|
||||
"identifier" TEXT UNIQUE NOT NULL,
|
||||
"level.min" INT DEFAULT 1,
|
||||
"level.max" INT NOT NULL,
|
||||
"level" INT NOT NULL,
|
||||
"level.vocabulary.showing" TEXT[],
|
||||
"quiz.settings" JSONB
|
||||
);
|
||||
@@ -17,6 +17,6 @@ CREATE TRIGGER "t_user_updatedAt"
|
||||
CREATE INDEX "idx_user_updatedAt" ON "user" ("updatedAt");
|
||||
CREATE INDEX "idx_user_identifier" ON "user" ("identifier");
|
||||
|
||||
INSERT INTO "user" ("id", "identifier") VALUES
|
||||
INSERT INTO "user" ("id", "identifier", "level") VALUES
|
||||
(uuid_nil(), '', 1),
|
||||
('00000000-0000-0000-0000-000000000001', 'wanikani', 1);
|
||||
Regular → Executable
File mode changed.
Regular → Executable
+7
-7
@@ -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');
|
||||
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
Regular → Executable
+7
-4
@@ -1,15 +1,18 @@
|
||||
CREATE TABLE radical (
|
||||
CREATE TABLE "character" (
|
||||
"entry" TEXT NOT NULL PRIMARY KEY,
|
||||
"sub" TEXT[] NOT NULL,
|
||||
"sup" TEXT[] NOT NULL,
|
||||
"var" TEXT[] NOT NULL
|
||||
"var" TEXT[] NOT NULL,
|
||||
"amalgamation" TEXT[] NOT NULL,
|
||||
"component" TEXT[] NOT NULL,
|
||||
"visual" TEXT[] NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX idx_radical_search ON radical
|
||||
CREATE INDEX idx_character_search ON "character"
|
||||
USING pgroonga ("entry", "sub", "sup", "var")
|
||||
WITH (tokenizer='TokenUnigram');
|
||||
|
||||
CREATE INDEX idx_radical_synonyms ON radical
|
||||
CREATE INDEX idx_character_synonyms ON "character"
|
||||
USING pgroonga ("entry" pgroonga_text_term_search_ops_v2)
|
||||
WITH (tokenizer='TokenUnigram');
|
||||
|
||||
Regular → Executable
File mode changed.
+2
-2
@@ -5,7 +5,7 @@ pg_ctl -o "-c listen_addresses='localhost'" -w restart
|
||||
cd /app
|
||||
|
||||
if [[ -d "./lib" ]]; then
|
||||
node ./lib/init.js
|
||||
node ./lib/index.js
|
||||
else
|
||||
yarn ts ./src/init.ts
|
||||
yarn ts ./src/index.ts
|
||||
fi
|
||||
Reference in new issue
Block a user