From 03df15818eca133286a7294574bef88a821ddd13 Mon Sep 17 00:00:00 2001 From: neviyn Date: Mon, 10 May 2021 15:34:27 +0100 Subject: [PATCH] Added some database indices --- src/main/resources/db/migration/V1_0__Database_Init.sql | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/resources/db/migration/V1_0__Database_Init.sql b/src/main/resources/db/migration/V1_0__Database_Init.sql index 1dce03a..f850bb7 100644 --- a/src/main/resources/db/migration/V1_0__Database_Init.sql +++ b/src/main/resources/db/migration/V1_0__Database_Init.sql @@ -19,6 +19,8 @@ CREATE TABLE booru.image CONSTRAINT uploader FOREIGN KEY (uploader) REFERENCES booru.member (id) ); +CREATE UNIQUE INDEX image_pk_index ON booru.image(id); + CREATE TABLE booru.role ( id bigserial NOT NULL PRIMARY KEY, @@ -32,6 +34,8 @@ CREATE TABLE booru.tag amount bigint NOT NULL ); +CREATE UNIQUE INDEX tag_pk_index ON booru.tag(id); + CREATE TABLE booru.tag_image ( tag_id bigint NOT NULL, @@ -41,6 +45,9 @@ CREATE TABLE booru.tag_image CONSTRAINT tag FOREIGN KEY (tag_id) REFERENCES booru.tag (id) ); +CREATE INDEX ti_image_index ON booru.tag_image(image_id); +CREATE INDEX ti_tag_index ON booru.tag_image(tag_id); + CREATE TABLE booru.member_roles ( member_id bigint NOT NULL,