UPDATE: Submission module
All checks were successful
Build and Release / release (push) Successful in 1m14s
All checks were successful
Build and Release / release (push) Successful in 1m14s
This commit is contained in:
@@ -22,4 +22,7 @@ CREATE INDEX idx_projects_status_updated
|
||||
ON projects (project_status, updated_at DESC);
|
||||
|
||||
CREATE INDEX idx_projects_title_trgm
|
||||
ON projects USING GIN (title gin_trgm_ops);
|
||||
ON projects USING GIN (title gin_trgm_ops);
|
||||
|
||||
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
|
||||
CREATE TABLE IF NOT EXISTS entities (
|
||||
id UUID PRIMARY KEY DEFAULT uuidv7(),
|
||||
project_id UUID NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
|
||||
name TEXT NOT NULL,
|
||||
slug TEXT,
|
||||
description TEXT,
|
||||
thumbnail_url TEXT,
|
||||
status SMALLINT,
|
||||
is_deleted BOOLEAN NOT NULL DEFAULT false,
|
||||
created_at TIMESTAMPTZ DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ DEFAULT now()
|
||||
);
|
||||
|
||||
|
||||
CREATE INDEX idx_entities_name_search
|
||||
ON entities USING GIN (name gin_trgm_ops);
|
||||
|
||||
CREATE INDEX idx_entities_project_id ON entities(project_id);
|
||||
|
||||
CREATE INDEX idx_entities_created_active
|
||||
ON entities(created_at DESC)
|
||||
WHERE is_deleted = false;
|
||||
@@ -2,8 +2,9 @@ CREATE EXTENSION IF NOT EXISTS pg_trgm;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS wikis (
|
||||
id UUID PRIMARY KEY DEFAULT uuidv7(),
|
||||
project_id UUID NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
|
||||
title TEXT,
|
||||
content TEXT,
|
||||
content JSONB,
|
||||
is_deleted BOOLEAN NOT NULL DEFAULT false,
|
||||
created_at TIMESTAMPTZ DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ DEFAULT now()
|
||||
@@ -13,9 +14,12 @@ CREATE TABLE IF NOT EXISTS wikis (
|
||||
CREATE TABLE IF NOT EXISTS entity_wikis (
|
||||
entity_id UUID REFERENCES entities(id) ON DELETE CASCADE,
|
||||
wiki_id UUID REFERENCES wikis(id) ON DELETE CASCADE,
|
||||
project_id UUID NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
|
||||
PRIMARY KEY (entity_id, wiki_id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_entity_wikis_project_id ON entity_wikis(project_id);
|
||||
|
||||
CREATE INDEX idx_entity_wikis_wiki_id
|
||||
ON entity_wikis(wiki_id);
|
||||
|
||||
@@ -27,6 +31,8 @@ CREATE INDEX idx_wikis_title_search
|
||||
ON wikis USING GIN (title gin_trgm_ops)
|
||||
WHERE is_deleted = false;
|
||||
|
||||
CREATE INDEX idx_wikis_project_id ON wikis(project_id);
|
||||
|
||||
CREATE TRIGGER trigger_wikis_updated_at
|
||||
BEFORE UPDATE ON wikis
|
||||
FOR EACH ROW
|
||||
@@ -4,6 +4,7 @@ CREATE EXTENSION IF NOT EXISTS postgis;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS geometries (
|
||||
id UUID PRIMARY KEY DEFAULT uuidv7(),
|
||||
project_id UUID NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
|
||||
geo_type SMALLINT NOT NULL DEFAULT 1,
|
||||
draw_geometry JSONB NOT NULL,
|
||||
binding JSONB,
|
||||
@@ -18,15 +19,12 @@ CREATE TABLE IF NOT EXISTS geometries (
|
||||
CREATE TABLE IF NOT EXISTS entity_geometries (
|
||||
entity_id UUID REFERENCES entities(id) ON DELETE CASCADE,
|
||||
geometry_id UUID REFERENCES geometries(id) ON DELETE CASCADE,
|
||||
project_id UUID NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
|
||||
PRIMARY KEY (entity_id, geometry_id)
|
||||
);
|
||||
|
||||
DROP INDEX IF EXISTS idx_geom_draw_geometry;
|
||||
DROP INDEX IF EXISTS idx_geom_bbox;
|
||||
DROP INDEX IF EXISTS idx_geom_time_range;
|
||||
DROP INDEX IF EXISTS idx_entity_geometries_geometry;
|
||||
DROP INDEX IF EXISTS idx_geom_binding;
|
||||
DROP INDEX IF EXISTS idx_geom_updated_at;
|
||||
CREATE INDEX idx_entity_geometries_project_id ON entity_geometries(project_id);
|
||||
|
||||
|
||||
CREATE INDEX idx_geom_draw_geometry
|
||||
ON geometries USING GIN (draw_geometry);
|
||||
@@ -49,6 +47,8 @@ CREATE INDEX idx_geom_updated_at
|
||||
ON geometries (updated_at DESC)
|
||||
WHERE is_deleted = false;
|
||||
|
||||
CREATE INDEX idx_geometries_project_id ON geometries(project_id);
|
||||
|
||||
DROP TRIGGER IF EXISTS trigger_geometries_updated_at ON geometries;
|
||||
CREATE TRIGGER trigger_geometries_updated_at
|
||||
BEFORE UPDATE ON geometries
|
||||
Reference in New Issue
Block a user