update database migration

This commit is contained in:
x
2026-01-25 22:04:16 +01:00
parent 292436df1f
commit c5c37e3aa4

View File

@@ -153,7 +153,8 @@ CREATE TABLE public.items (
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),
is_comments_locked boolean DEFAULT false NOT NULL
); );
@@ -429,6 +430,157 @@ CREATE TABLE public.user_sessions (
ALTER TABLE public.user_sessions OWNER TO f0ck; ALTER TABLE public.user_sessions OWNER TO f0ck;
--
-- Name: comments; Type: TABLE; Schema: public; Owner: f0ck
--
CREATE TABLE public.comments (
id integer NOT NULL,
item_id integer NOT NULL,
user_id integer NOT NULL,
parent_id integer,
content text NOT NULL,
is_deleted boolean DEFAULT false,
created_at timestamp with time zone DEFAULT now(),
updated_at timestamp with time zone,
vote_score integer DEFAULT 0,
is_pinned boolean DEFAULT false
);
ALTER TABLE public.comments OWNER TO f0ck;
--
-- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: f0ck
--
CREATE SEQUENCE public.comments_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.comments_id_seq OWNER TO f0ck;
--
-- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: f0ck
--
ALTER SEQUENCE public.comments_id_seq OWNED BY public.comments.id;
--
-- Name: notifications; Type: TABLE; Schema: public; Owner: f0ck
--
CREATE TABLE public.notifications (
id integer NOT NULL,
user_id integer NOT NULL,
type character varying(32) NOT NULL,
reference_id integer NOT NULL,
item_id integer NOT NULL,
is_read boolean DEFAULT false,
created_at timestamp with time zone DEFAULT now()
);
ALTER TABLE public.notifications OWNER TO f0ck;
--
-- Name: notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: f0ck
--
CREATE SEQUENCE public.notifications_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.notifications_id_seq OWNER TO f0ck;
--
-- Name: notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: f0ck
--
ALTER SEQUENCE public.notifications_id_seq OWNED BY public.notifications.id;
--
-- Name: comment_subscriptions; Type: TABLE; Schema: public; Owner: f0ck
--
CREATE TABLE public.comment_subscriptions (
user_id integer NOT NULL,
item_id integer NOT NULL,
created_at timestamp with time zone DEFAULT now()
);
ALTER TABLE public.comment_subscriptions OWNER TO f0ck;
--
-- Name: custom_emojis; Type: TABLE; Schema: public; Owner: f0ck
--
CREATE TABLE public.custom_emojis (
id integer NOT NULL,
trigger character varying(32) NOT NULL,
url character varying(255) NOT NULL,
created_at timestamp with time zone DEFAULT now()
);
ALTER TABLE public.custom_emojis OWNER TO f0ck;
--
-- Name: custom_emojis_id_seq; Type: SEQUENCE; Schema: public; Owner: f0ck
--
CREATE SEQUENCE public.custom_emojis_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.custom_emojis_id_seq OWNER TO f0ck;
--
-- Name: custom_emojis_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: f0ck
--
ALTER SEQUENCE public.custom_emojis_id_seq OWNED BY public.custom_emojis.id;
--
-- Name: comments id; Type: DEFAULT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.comments ALTER COLUMN id SET DEFAULT nextval('public.comments_id_seq'::regclass);
--
-- Name: custom_emojis id; Type: DEFAULT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.custom_emojis ALTER COLUMN id SET DEFAULT nextval('public.custom_emojis_id_seq'::regclass);
--
-- Name: notifications id; Type: DEFAULT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.notifications ALTER COLUMN id SET DEFAULT nextval('public.notifications_id_seq'::regclass);
-- --
-- Name: favorites idx_16521_primary; Type: CONSTRAINT; Schema: public; Owner: f0ck -- Name: favorites idx_16521_primary; Type: CONSTRAINT; Schema: public; Owner: f0ck
-- --
@@ -469,6 +621,81 @@ ALTER TABLE ONLY public.user_sessions
ADD CONSTRAINT idx_16572_primary PRIMARY KEY (id); ADD CONSTRAINT idx_16572_primary PRIMARY KEY (id);
--
-- Name: comments comments_pkey; Type: CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.comments
ADD CONSTRAINT comments_pkey PRIMARY KEY (id);
--
-- Name: comment_subscriptions comment_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.comment_subscriptions
ADD CONSTRAINT comment_subscriptions_pkey PRIMARY KEY (user_id, item_id);
--
-- Name: custom_emojis custom_emojis_pkey; Type: CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.custom_emojis
ADD CONSTRAINT custom_emojis_pkey PRIMARY KEY (id);
--
-- Name: custom_emojis custom_emojis_trigger_key; Type: CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.custom_emojis
ADD CONSTRAINT custom_emojis_trigger_key UNIQUE (trigger);
--
-- Name: notifications notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.notifications
ADD CONSTRAINT notifications_pkey PRIMARY KEY (id);
--
-- Name: idx_comments_is_pinned; Type: INDEX; Schema: public; Owner: f0ck
--
CREATE INDEX idx_comments_is_pinned ON public.comments USING btree (is_pinned) WHERE (is_pinned = true);
--
-- Name: idx_comments_item_id; Type: INDEX; Schema: public; Owner: f0ck
--
CREATE INDEX idx_comments_item_id ON public.comments USING btree (item_id);
--
-- Name: idx_comments_user_id; Type: INDEX; Schema: public; Owner: f0ck
--
CREATE INDEX idx_comments_user_id ON public.comments USING btree (user_id);
--
-- Name: idx_notifications_unread; Type: INDEX; Schema: public; Owner: f0ck
--
CREATE INDEX idx_notifications_unread ON public.notifications USING btree (user_id) WHERE (is_read = false);
--
-- Name: idx_notifications_user_id; Type: INDEX; Schema: public; Owner: f0ck
--
CREATE INDEX idx_notifications_user_id ON public.notifications USING btree (user_id);
-- --
-- Name: items items_checksum; Type: CONSTRAINT; Schema: public; Owner: f0ck -- Name: items items_checksum; Type: CONSTRAINT; Schema: public; Owner: f0ck
-- --
@@ -657,6 +884,62 @@ ALTER TABLE ONLY public.user_sessions
ADD CONSTRAINT user_sessions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE CASCADE; ADD CONSTRAINT user_sessions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE CASCADE;
--
-- Name: comments comments_item_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.comments
ADD CONSTRAINT comments_item_id_fkey FOREIGN KEY (item_id) REFERENCES public.items(id) ON DELETE CASCADE;
--
-- Name: comments comments_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.comments
ADD CONSTRAINT comments_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES public.comments(id) ON DELETE SET NULL;
--
-- Name: comments comments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.comments
ADD CONSTRAINT comments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE CASCADE;
--
-- Name: comment_subscriptions comment_subscriptions_item_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.comment_subscriptions
ADD CONSTRAINT comment_subscriptions_item_id_fkey FOREIGN KEY (item_id) REFERENCES public.items(id) ON DELETE CASCADE;
--
-- Name: comment_subscriptions comment_subscriptions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.comment_subscriptions
ADD CONSTRAINT comment_subscriptions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE CASCADE;
--
-- Name: notifications notifications_item_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.notifications
ADD CONSTRAINT notifications_item_id_fkey FOREIGN KEY (item_id) REFERENCES public.items(id) ON DELETE CASCADE;
--
-- Name: notifications notifications_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: f0ck
--
ALTER TABLE ONLY public.notifications
ADD CONSTRAINT notifications_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id) ON DELETE CASCADE;
-- --
-- Name: alltables; Type: PUBLICATION; Schema: -; Owner: postgres -- Name: alltables; Type: PUBLICATION; Schema: -; Owner: postgres
-- --