feat: minor changes to db and new query
Some checks failed
Build and Deploy Go App / build (push) Failing after 5m56s
Build and Deploy Go App / deploy (push) Has been skipped

This commit is contained in:
Iron_Felix 2025-11-15 02:51:52 +03:00
parent e8783a0e9d
commit 5cc6757900
4 changed files with 152 additions and 15 deletions

View file

@ -44,6 +44,7 @@ CREATE TABLE studios (
CREATE TABLE titles (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
-- example {"ru": ["Атака титанов", "Атака Титанов"],"en": ["Attack on Titan", "AoT"],"ja": ["進撃の巨人", "しんげきのきょじん"]}
title_names jsonb NOT NULL,
studio_id bigint NOT NULL REFERENCES studios (id),
poster_id bigint REFERENCES images (id),
@ -55,6 +56,7 @@ CREATE TABLE titles (
season int CHECK (season >= 0),
episodes_aired int CHECK (episodes_aired >= 0),
episodes_all int CHECK (episodes_all >= 0),
-- example { "1": "50.50", "2": "23.23"}
episodes_len jsonb,
CHECK ((episodes_aired IS NULL AND episodes_all IS NULL)
OR (episodes_aired IS NOT NULL AND episodes_all IS NOT NULL
@ -86,7 +88,7 @@ CREATE TABLE signals (
);
CREATE TABLE external_ids (
user_id NOT NULL REFERENCES users (id),
user_id bigint NOT NULL REFERENCES users (id),
service_id bigint REFERENCES external_services (id),
external_id text NOT NULL
);