.
All checks were successful
fetch npm modules / f0ck the f0cker (push) Successful in 15s

This commit is contained in:
Flummi 2024-06-30 13:41:09 +02:00
parent f5225a71c5
commit 3b29f5f9d5

611
f0ck.sql
View File

@ -1,4 +1,9 @@
\connect "f0ck"; --
-- PostgreSQL database dump
--
-- Dumped from database version 16.2
-- Dumped by pg_dump version 16.2
SET statement_timeout = 0; SET statement_timeout = 0;
SET lock_timeout = 0; SET lock_timeout = 0;
@ -11,7 +16,33 @@ SET xmloption = content;
SET client_min_messages = warning; SET client_min_messages = warning;
SET row_security = off; SET row_security = off;
CREATE EXTENSION unaccent; --
-- Name: public; Type: SCHEMA; Schema: -; Owner: postgres
--
-- *not* creating schema, since initdb creates it
ALTER SCHEMA public OWNER TO postgres;
--
-- Name: unaccent; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS unaccent WITH SCHEMA public;
--
-- Name: EXTENSION unaccent; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION unaccent IS 'text search dictionary that removes accents';
--
-- Name: delete_unused_tags(); Type: FUNCTION; Schema: public; Owner: f0ck
--
CREATE FUNCTION public.delete_unused_tags() RETURNS trigger CREATE FUNCTION public.delete_unused_tags() RETURNS trigger
LANGUAGE plpgsql LANGUAGE plpgsql
AS $$ AS $$
@ -21,14 +52,17 @@ begin
tags.id not in (select tag_id from tags_assign) and tags.id not in (select tag_id from tags_assign) and
tags.id = OLD.tag_id and tags.id = OLD.tag_id and
tags.tag != 'sfw' and tags.tag != 'sfw' and
tags.tag != 'nsfw' and tags.tag != 'nsfw';
tags.tag != 'hentai' and
tags.tag != 'audio';
return OLD; return OLD;
end $$; end $$;
ALTER FUNCTION public.delete_unused_tags() OWNER TO f0ck; ALTER FUNCTION public.delete_unused_tags() OWNER TO f0ck;
--
-- Name: fill_normalized(); Type: FUNCTION; Schema: public; Owner: f0ck
--
CREATE FUNCTION public.fill_normalized() RETURNS trigger CREATE FUNCTION public.fill_normalized() RETURNS trigger
LANGUAGE plpgsql LANGUAGE plpgsql
AS $$ AS $$
@ -37,8 +71,13 @@ begin
return NEW; return NEW;
end$$; end$$;
ALTER FUNCTION public.fill_normalized() OWNER TO f0ck; ALTER FUNCTION public.fill_normalized() OWNER TO f0ck;
--
-- Name: slugify(text); Type: FUNCTION; Schema: public; Owner: f0ck
--
CREATE FUNCTION public.slugify(v text) RETURNS text CREATE FUNCTION public.slugify(v text) RETURNS text
LANGUAGE plpgsql LANGUAGE plpgsql
AS $$ AS $$
@ -47,15 +86,47 @@ BEGIN
END; END;
$$; $$;
ALTER FUNCTION public.slugify(v text) OWNER TO f0ck; ALTER FUNCTION public.slugify(v text) OWNER TO f0ck;
--
-- Name: unaccent_text(text); Type: FUNCTION; Schema: public; Owner: f0ck
--
CREATE FUNCTION public.unaccent_text(text) RETURNS text
LANGUAGE sql IMMUTABLE COST 1
AS $_$
-- unaccent is STABLE, but the indexes must use IMMUTABLE functions.
-- comment this line out when calling pg_dump.
SELECT unaccent($1);
-- Uncomment this line when calling pg_dump.
--SELECT ''::text;
$_$;
ALTER FUNCTION public.unaccent_text(text) OWNER TO f0ck;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: favorites; Type: TABLE; Schema: public; Owner: f0ck
--
CREATE TABLE public.favorites ( CREATE TABLE public.favorites (
user_id integer NOT NULL, user_id integer NOT NULL,
item_id integer NOT NULL item_id integer NOT NULL
); );
ALTER TABLE public.favorites OWNER TO f0ck; ALTER TABLE public.favorites OWNER TO f0ck;
--
-- Name: items_id_seq; Type: SEQUENCE; Schema: public; Owner: f0ck
--
CREATE SEQUENCE public.items_id_seq CREATE SEQUENCE public.items_id_seq
START WITH 1 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
@ -63,7 +134,12 @@ CREATE SEQUENCE public.items_id_seq
NO MAXVALUE NO MAXVALUE
CACHE 1; CACHE 1;
ALTER TABLE public.items_id_seq OWNER TO f0ck;
ALTER SEQUENCE public.items_id_seq OWNER TO f0ck;
--
-- Name: items; Type: TABLE; Schema: public; Owner: f0ck
--
CREATE TABLE public.items ( CREATE TABLE public.items (
id integer DEFAULT nextval('public.items_id_seq'::regclass) NOT NULL, id integer DEFAULT nextval('public.items_id_seq'::regclass) NOT NULL,
@ -73,18 +149,115 @@ CREATE TABLE public.items (
size integer NOT NULL, size integer NOT NULL,
checksum character varying(255) NOT NULL, checksum character varying(255) NOT NULL,
username character varying(40) NOT NULL, username character varying(40) NOT NULL,
userchannel character varying(100) NOT NULL, userchannel character varying(255) NOT NULL,
usernetwork character varying(40) NOT NULL, usernetwork character varying(40) NOT NULL,
stamp integer NOT NULL, stamp integer NOT NULL,
active boolean NOT NULL, active boolean NOT NULL,
thumb character varying(100) thumb character varying(100)
); );
ALTER TABLE public.items OWNER TO f0ck; ALTER TABLE public.items OWNER TO f0ck;
--
-- Name: COLUMN items.src; Type: COMMENT; Schema: public; Owner: f0ck
--
COMMENT ON COLUMN public.items.src IS 'src-Link'; COMMENT ON COLUMN public.items.src IS 'src-Link';
--
-- Name: COLUMN items.dest; Type: COMMENT; Schema: public; Owner: f0ck
--
COMMENT ON COLUMN public.items.dest IS 'filename'; COMMENT ON COLUMN public.items.dest IS 'filename';
--
-- Name: items_li; Type: VIEW; Schema: public; Owner: f0ck
--
CREATE VIEW public.items_li AS
SELECT
NULL::integer AS id,
NULL::character varying(255) AS src,
NULL::character varying(40) AS dest,
NULL::character varying(100) AS mime,
NULL::integer AS size,
NULL::character varying(255) AS checksum,
NULL::character varying(40) AS username,
NULL::character varying(255) AS userchannel,
NULL::character varying(40) AS usernetwork,
NULL::integer AS stamp;
ALTER VIEW public.items_li OWNER TO f0ck;
--
-- Name: tags_assign; Type: TABLE; Schema: public; Owner: f0ck
--
CREATE TABLE public.tags_assign (
item_id integer NOT NULL,
tag_id integer NOT NULL,
user_id integer DEFAULT 10 NOT NULL
);
ALTER TABLE public.tags_assign OWNER TO f0ck;
--
-- Name: tags_nsfp; Type: TABLE; Schema: public; Owner: f0ck
--
CREATE TABLE public.tags_nsfp (
id integer NOT NULL
);
ALTER TABLE public.tags_nsfp OWNER TO f0ck;
--
-- Name: items_sfw; Type: VIEW; Schema: public; Owner: f0ck
--
CREATE VIEW public.items_sfw AS
SELECT ( SELECT
CASE
WHEN (tags_assign.tag_id > 0) THEN tags_assign.tag_id
ELSE 0
END AS "case"
FROM public.tags_assign
WHERE ((tags_assign.tag_id = ANY (ARRAY[1, 2])) AND (tags_assign.item_id = items.id))) AS sfw,
( SELECT
CASE
WHEN (tags_assign.tag_id > 0) THEN 1
ELSE 0
END AS "case"
FROM public.tags_assign
WHERE ((tags_assign.tag_id IN ( SELECT tags_nsfp.id
FROM public.tags_nsfp)) AND (tags_assign.item_id = items.id))
LIMIT 1) AS nsfp,
id,
src,
dest,
mime,
size,
checksum,
username,
userchannel,
usernetwork,
stamp,
active
FROM public.items;
ALTER VIEW public.items_sfw OWNER TO f0ck;
--
-- Name: tags_id_seq; Type: SEQUENCE; Schema: public; Owner: f0ck
--
CREATE SEQUENCE public.tags_id_seq CREATE SEQUENCE public.tags_id_seq
START WITH 1 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
@ -92,30 +265,25 @@ CREATE SEQUENCE public.tags_id_seq
NO MAXVALUE NO MAXVALUE
CACHE 1; CACHE 1;
ALTER TABLE public.tags_id_seq OWNER TO f0ck;
ALTER SEQUENCE public.tags_id_seq OWNER TO f0ck;
--
-- Name: tags; Type: TABLE; Schema: public; Owner: f0ck
--
CREATE TABLE public.tags ( CREATE TABLE public.tags (
id integer DEFAULT nextval('public.tags_id_seq'::regclass) NOT NULL, id integer DEFAULT nextval('public.tags_id_seq'::regclass) NOT NULL,
tag character varying(45) NOT NULL, tag character varying(70) NOT NULL,
normalized character varying(45) NOT NULL normalized character varying(70) NOT NULL
); );
ALTER TABLE public.tags OWNER TO f0ck; ALTER TABLE public.tags OWNER TO f0ck;
CREATE TABLE public.tags_alias ( --
tag_orig_id integer NOT NULL, -- Name: user_id_seq; Type: SEQUENCE; Schema: public; Owner: f0ck
tag_alias character varying NOT NULL --
);
ALTER TABLE public.tags_alias OWNER TO f0ck;
CREATE TABLE public.tags_assign (
item_id integer NOT NULL,
tag_id integer NOT NULL,
user_id integer DEFAULT 2 NOT NULL
);
ALTER TABLE public.tags_assign OWNER TO f0ck;
CREATE SEQUENCE public.user_id_seq CREATE SEQUENCE public.user_id_seq
START WITH 1 START WITH 1
@ -124,31 +292,128 @@ CREATE SEQUENCE public.user_id_seq
NO MAXVALUE NO MAXVALUE
CACHE 1; CACHE 1;
ALTER TABLE public.user_id_seq OWNER TO f0ck;
ALTER SEQUENCE public.user_id_seq OWNER TO f0ck;
--
-- Name: user; Type: TABLE; Schema: public; Owner: f0ck
--
CREATE TABLE public."user" ( CREATE TABLE public."user" (
id integer DEFAULT nextval('public.user_id_seq'::regclass) NOT NULL, id integer DEFAULT nextval('public.user_id_seq'::regclass) NOT NULL,
login character varying(255) NOT NULL, login character varying(255) NOT NULL,
"user" character varying(255) NOT NULL, "user" character varying(255) NOT NULL,
password character varying(167) NOT NULL, password character varying(167) NOT NULL,
admin boolean NOT NULL admin boolean NOT NULL,
created_at timestamp without time zone DEFAULT now() NOT NULL
); );
ALTER TABLE public."user" OWNER TO f0ck; ALTER TABLE public."user" OWNER TO f0ck;
--
-- Name: items_tags; Type: VIEW; Schema: public; Owner: f0ck
--
CREATE VIEW public.items_tags AS
SELECT ( SELECT
CASE
WHEN (tags_assign.tag_id > 0) THEN tags_assign.tag_id
ELSE 0
END AS "case"
FROM public.tags_assign
WHERE ((tags_assign.tag_id = ANY (ARRAY[1, 2])) AND (tags_assign.item_id = items.id))) AS sfw,
( SELECT
CASE
WHEN (tags_assign.tag_id > 0) THEN 1
ELSE 0
END AS "case"
FROM public.tags_assign
WHERE ((tags_assign.tag_id IN ( SELECT tags_nsfp.id
FROM public.tags_nsfp)) AND (tags_assign.item_id = items.id))
LIMIT 1) AS nsfp,
( SELECT jsonb_agg(jsonb_build_object('id', tags.id, 'normalized', tags.normalized)) AS jsonb_agg
FROM (public.tags_assign
LEFT JOIN public.tags ON ((tags.id = tags_assign.tag_id)))
WHERE (tags_assign.item_id = items.id)) AS tags,
( SELECT jsonb_agg(jsonb_build_object('id', favorites.user_id, 'user', "user"."user")) AS jsonb_agg
FROM (public.favorites
LEFT JOIN public."user" ON (("user".id = favorites.user_id)))
WHERE (favorites.item_id = items.id)) AS favs,
id,
src,
dest,
mime,
size,
checksum,
username,
userchannel,
usernetwork,
stamp,
active
FROM public.items;
ALTER VIEW public.items_tags OWNER TO f0ck;
--
-- Name: tags_alias; Type: TABLE; Schema: public; Owner: f0ck
--
CREATE TABLE public.tags_alias (
tag_orig_id integer NOT NULL,
tag_alias character varying NOT NULL
);
ALTER TABLE public.tags_alias OWNER TO f0ck;
--
-- Name: user_alias; Type: TABLE; Schema: public; Owner: f0ck
--
CREATE TABLE public.user_alias (
userid integer NOT NULL,
alias character varying(255) NOT NULL
);
ALTER TABLE ONLY public.user_alias REPLICA IDENTITY FULL;
ALTER TABLE public.user_alias OWNER TO f0ck;
--
-- Name: user_options; Type: TABLE; Schema: public; Owner: f0ck
--
CREATE TABLE public.user_options ( CREATE TABLE public.user_options (
user_id integer NOT NULL, user_id integer NOT NULL,
mode integer NOT NULL, mode integer NOT NULL,
theme character varying(50) NOT NULL, theme character varying(50) NOT NULL,
avatar integer DEFAULT 1 NOT NULL, avatar integer DEFAULT 56660 NOT NULL,
fullscreen integer DEFAULT 0 NOT NULL fullscreen smallint DEFAULT '0'::smallint NOT NULL
); );
ALTER TABLE public.user_options OWNER TO f0ck; ALTER TABLE public.user_options OWNER TO f0ck;
CREATE SEQUENCE public.user_sessions_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1; --
-- Name: user_sessions_id_seq; Type: SEQUENCE; Schema: public; Owner: f0ck
--
ALTER TABLE public.user_sessions_id_seq OWNER TO f0ck; CREATE SEQUENCE public.user_sessions_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.user_sessions_id_seq OWNER TO f0ck;
--
-- Name: user_sessions; Type: TABLE; Schema: public; Owner: f0ck
--
CREATE TABLE public.user_sessions ( CREATE TABLE public.user_sessions (
id integer DEFAULT nextval('public.user_sessions_id_seq'::regclass) NOT NULL, id integer DEFAULT nextval('public.user_sessions_id_seq'::regclass) NOT NULL,
@ -161,55 +426,255 @@ CREATE TABLE public.user_sessions (
kmsi smallint DEFAULT '0'::smallint NOT NULL kmsi smallint DEFAULT '0'::smallint NOT NULL
); );
ALTER TABLE public.user_sessions OWNER TO f0ck; ALTER TABLE public.user_sessions OWNER TO f0ck;
COPY public.items (id, src, dest, mime, size, checksum, username, userchannel, usernetwork, stamp, active, thumb) FROM stdin; --
1 b761fa9339.png b761fa9339.png image/png 164 keinPlan Flummi #f0ck n0xy 1471250800 t -- Name: favorites idx_16521_primary; Type: CONSTRAINT; Schema: public; Owner: f0ck
\. --
COPY public.tags (id, tag, normalized) FROM stdin; ALTER TABLE ONLY public.favorites
1 sfw sfw ADD CONSTRAINT idx_16521_primary PRIMARY KEY (user_id, item_id);
2 nsfw nsfw
3 audio audio
4 hentai hentai
\.
COPY public.tags_assign (item_id, tag_id, user_id) FROM stdin;
1 1 1
\.
COPY public."user" (id, login, "user", password, level) FROM stdin; --
1 autotagger autotagger f0ck you 0 -- Name: items idx_16526_primary; Type: CONSTRAINT; Schema: public; Owner: f0ck
2 deleted deleted f0ck you 0 --
\.
ALTER TABLE ONLY public.items
ADD CONSTRAINT idx_16526_primary PRIMARY KEY (id);
--
-- Name: user idx_16554_primary; Type: CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public."user"
ADD CONSTRAINT idx_16554_primary PRIMARY KEY (id);
--
-- Name: user_options idx_16567_user_id; Type: CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.user_options
ADD CONSTRAINT idx_16567_user_id UNIQUE (user_id);
--
-- Name: user_sessions idx_16572_primary; Type: CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.user_sessions
ADD CONSTRAINT idx_16572_primary PRIMARY KEY (id);
--
-- Name: items items_checksum; Type: CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.items
ADD CONSTRAINT items_checksum UNIQUE (checksum);
--
-- Name: tags_alias tags_alias_tag_alias_tag_orig_id; Type: CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.tags_alias
ADD CONSTRAINT tags_alias_tag_alias_tag_orig_id UNIQUE (tag_alias, tag_orig_id);
--
-- Name: tags_alias tags_alias_tag_orig_id; Type: CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.tags_alias
ADD CONSTRAINT tags_alias_tag_orig_id PRIMARY KEY (tag_orig_id);
--
-- Name: tags_assign tags_assign_item_id_tag_id_primary; Type: CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.tags_assign
ADD CONSTRAINT tags_assign_item_id_tag_id_primary PRIMARY KEY (item_id, tag_id);
--
-- Name: tags_assign tags_assign_item_id_tag_id_unique; Type: CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.tags_assign
ADD CONSTRAINT tags_assign_item_id_tag_id_unique UNIQUE (item_id, tag_id);
--
-- Name: tags tags_id; Type: CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.tags
ADD CONSTRAINT tags_id PRIMARY KEY (id);
--
-- Name: tags tags_normalized; Type: CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.tags
ADD CONSTRAINT tags_normalized UNIQUE (normalized);
--
-- Name: tags tags_tag; Type: CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.tags
ADD CONSTRAINT tags_tag UNIQUE (tag);
--
-- Name: user_options user_options_user_id; Type: CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.user_options
ADD CONSTRAINT user_options_user_id PRIMARY KEY (user_id);
--
-- Name: items_li _RETURN; Type: RULE; Schema: public; Owner: f0ck
--
CREATE OR REPLACE VIEW public.items_li AS
SELECT items.id,
items.src,
items.dest,
items.mime,
items.size,
items.checksum,
items.username,
items.userchannel,
items.usernetwork,
items.stamp
FROM ((public.items
JOIN public.tags_assign ta1 ON (((ta1.tag_id = 1) AND (ta1.item_id = items.id))))
JOIN public.tags_assign ta2 ON (((NOT (ta2.tag_id IN ( SELECT tags_nsfp.id
FROM public.tags_nsfp))) AND (ta2.item_id = items.id))))
WHERE items.active
GROUP BY items.id;
--
-- Name: tags_assign tags_assign_ad; Type: TRIGGER; Schema: public; Owner: f0ck
--
SELECT pg_catalog.setval('public.items_id_seq', 2, true);
SELECT pg_catalog.setval('public.tags_id_seq', 5, true);
SELECT pg_catalog.setval('public.user_id_seq', 3, true);
SELECT pg_catalog.setval('public.user_sessions_id_seq', 1, true);
ALTER TABLE ONLY public.favorites ADD CONSTRAINT idx_16521_primary PRIMARY KEY (user_id, item_id);
ALTER TABLE ONLY public.items ADD CONSTRAINT idx_16526_primary PRIMARY KEY (id);
ALTER TABLE ONLY public."user" ADD CONSTRAINT idx_16554_primary PRIMARY KEY (id);
ALTER TABLE ONLY public.user_options ADD CONSTRAINT idx_16567_user_id UNIQUE (user_id);
ALTER TABLE ONLY public.user_sessions ADD CONSTRAINT idx_16572_primary PRIMARY KEY (id);
ALTER TABLE ONLY public.items ADD CONSTRAINT items_checksum UNIQUE (checksum);
ALTER TABLE ONLY public.tags_alias ADD CONSTRAINT tags_alias_tag_alias_tag_orig_id UNIQUE (tag_alias, tag_orig_id);
ALTER TABLE ONLY public.tags_alias ADD CONSTRAINT tags_alias_tag_orig_id PRIMARY KEY (tag_orig_id);
ALTER TABLE ONLY public.tags_assign ADD CONSTRAINT tags_assign_item_id_tag_id_primary PRIMARY KEY (item_id, tag_id);
ALTER TABLE ONLY public.tags_assign ADD CONSTRAINT tags_assign_item_id_tag_id_unique UNIQUE (item_id, tag_id);
ALTER TABLE ONLY public.tags ADD CONSTRAINT tags_id PRIMARY KEY (id);
ALTER TABLE ONLY public.tags ADD CONSTRAINT tags_normalized UNIQUE (normalized);
ALTER TABLE ONLY public.tags ADD CONSTRAINT tags_tag UNIQUE (tag);
ALTER TABLE ONLY public.user_options ADD CONSTRAINT user_options_user_id PRIMARY KEY (user_id);
CREATE TRIGGER tags_assign_ad AFTER DELETE ON public.tags_assign FOR EACH ROW EXECUTE FUNCTION public.delete_unused_tags(); CREATE TRIGGER tags_assign_ad AFTER DELETE ON public.tags_assign FOR EACH ROW EXECUTE FUNCTION public.delete_unused_tags();
--
-- Name: tags tags_bi; Type: TRIGGER; Schema: public; Owner: f0ck
--
CREATE TRIGGER tags_bi BEFORE INSERT ON public.tags FOR EACH ROW EXECUTE FUNCTION public.fill_normalized(); CREATE TRIGGER tags_bi BEFORE INSERT ON public.tags FOR EACH ROW EXECUTE FUNCTION public.fill_normalized();
--
-- Name: tags tags_bu; Type: TRIGGER; Schema: public; Owner: f0ck
--
CREATE TRIGGER tags_bu BEFORE UPDATE ON public.tags FOR EACH ROW EXECUTE FUNCTION public.fill_normalized(); CREATE TRIGGER tags_bu BEFORE UPDATE ON public.tags FOR EACH ROW EXECUTE FUNCTION public.fill_normalized();
ALTER TABLE ONLY public.favorites ADD CONSTRAINT favorites_item_id_fkey FOREIGN KEY (item_id) REFERENCES public.items(id) ON DELETE CASCADE;
ALTER TABLE ONLY public.favorites ADD CONSTRAINT favorites_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE CASCADE;
ALTER TABLE ONLY public.tags_alias ADD CONSTRAINT tags_alias_tag_orig_id_fkey FOREIGN KEY (tag_orig_id) REFERENCES public.tags(id) ON DELETE CASCADE; --
ALTER TABLE ONLY public.tags_assign ADD CONSTRAINT tags_assign_item_id_fkey FOREIGN KEY (item_id) REFERENCES public.items(id) ON DELETE CASCADE; -- Name: favorites favorites_item_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: f0ck
ALTER TABLE ONLY public.tags_assign ADD CONSTRAINT tags_assign_tag_id_fkey FOREIGN KEY (tag_id) REFERENCES public.tags(id) ON DELETE CASCADE; --
ALTER TABLE ONLY public.tags_assign ADD CONSTRAINT tags_assign_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE SET DEFAULT;
ALTER TABLE ONLY public.user_options ADD CONSTRAINT user_options_avatar_fkey FOREIGN KEY (avatar) REFERENCES public.items(id) ON DELETE SET DEFAULT; ALTER TABLE ONLY public.favorites
ALTER TABLE ONLY public.user_options ADD CONSTRAINT user_options_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE CASCADE; ADD CONSTRAINT favorites_item_id_fkey FOREIGN KEY (item_id) REFERENCES public.items(id) ON DELETE CASCADE;
ALTER TABLE ONLY public.user_sessions ADD CONSTRAINT user_sessions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE CASCADE;
--
-- Name: favorites favorites_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.favorites
ADD CONSTRAINT favorites_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE CASCADE;
--
-- Name: tags_alias tags_alias_tag_orig_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.tags_alias
ADD CONSTRAINT tags_alias_tag_orig_id_fkey FOREIGN KEY (tag_orig_id) REFERENCES public.tags(id) ON DELETE CASCADE;
--
-- Name: tags_assign tags_assign_item_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.tags_assign
ADD CONSTRAINT tags_assign_item_id_fkey FOREIGN KEY (item_id) REFERENCES public.items(id) ON DELETE CASCADE;
--
-- Name: tags_assign tags_assign_tag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.tags_assign
ADD CONSTRAINT tags_assign_tag_id_fkey FOREIGN KEY (tag_id) REFERENCES public.tags(id) ON DELETE CASCADE;
--
-- Name: tags_assign tags_assign_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.tags_assign
ADD CONSTRAINT tags_assign_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE SET DEFAULT;
--
-- Name: user_options user_options_avatar_fkey; Type: FK CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.user_options
ADD CONSTRAINT user_options_avatar_fkey FOREIGN KEY (avatar) REFERENCES public.items(id) ON DELETE SET DEFAULT;
--
-- Name: user_options user_options_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.user_options
ADD CONSTRAINT user_options_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE CASCADE;
--
-- Name: user_sessions user_sessions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.user_sessions
ADD CONSTRAINT user_sessions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE CASCADE;
--
-- Name: alltables; Type: PUBLICATION; Schema: -; Owner: postgres
--
CREATE PUBLICATION alltables FOR ALL TABLES WITH (publish = 'insert, update, delete, truncate');
ALTER PUBLICATION alltables OWNER TO postgres;
--
-- Name: SCHEMA public; Type: ACL; Schema: -; Owner: postgres
--
REVOKE USAGE ON SCHEMA public FROM PUBLIC;
GRANT ALL ON SCHEMA public TO PUBLIC;
--
-- PostgreSQL database dump complete
--