votes: add is_deleted flag to post_votes table.

Add an is_deleted flag to post_votes so they can be soft-deleted in the future.
This commit is contained in:
evazion
2021-11-21 02:35:19 -06:00
parent 35c97d0836
commit be5173c8dd
3 changed files with 29 additions and 2 deletions

View File

@@ -1672,7 +1672,8 @@ CREATE TABLE public.post_votes (
user_id integer NOT NULL,
score integer NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
updated_at timestamp without time zone NOT NULL,
is_deleted boolean DEFAULT false
);
@@ -4213,6 +4214,13 @@ CREATE INDEX index_post_versions_on_version ON public.post_versions USING btree
CREATE INDEX index_post_votes_on_created_at ON public.post_votes USING btree (created_at);
--
-- Name: index_post_votes_on_is_deleted; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_post_votes_on_is_deleted ON public.post_votes USING btree (is_deleted) WHERE (is_deleted = true);
--
-- Name: index_post_votes_on_post_id; Type: INDEX; Schema: public; Owner: -
--
@@ -4227,6 +4235,13 @@ CREATE INDEX index_post_votes_on_post_id ON public.post_votes USING btree (post_
CREATE INDEX index_post_votes_on_user_id ON public.post_votes USING btree (user_id);
--
-- Name: index_post_votes_on_user_id_and_post_id; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX index_post_votes_on_user_id_and_post_id ON public.post_votes USING btree (user_id, post_id) WHERE (is_deleted = false);
--
-- Name: index_posts_on_approver_id; Type: INDEX; Schema: public; Owner: -
--
@@ -5057,6 +5072,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20211015223510'),
('20211018045429'),
('20211018062916'),
('20211023225730');
('20211023225730'),
('20211121080239');