ip bans: add hit counter, deleted flag, new ban type.

* Make IP bans soft deletable.
* Add a hit counter to track how many times an IP ban has blocked someone.
* Add a last hit timestamp to track when the IP ban last blocked someone.
* Add a new type of IP ban, the signup ban. Signup bans restrict new
  signups from editing anything until they've verified their email
  address.
This commit is contained in:
evazion
2020-04-06 14:12:56 -05:00
parent 98e84d83fb
commit b2ee1f0766
18 changed files with 178 additions and 40 deletions

View File

@@ -2316,12 +2316,16 @@ UNION ALL
--
CREATE TABLE public.ip_bans (
id integer NOT NULL,
creator_id integer NOT NULL,
ip_addr inet NOT NULL,
reason text 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,
id integer NOT NULL,
is_deleted boolean DEFAULT false NOT NULL,
category integer DEFAULT 0 NOT NULL,
hit_count integer DEFAULT 0 NOT NULL,
last_hit_at timestamp without time zone
);
@@ -6428,6 +6432,13 @@ CREATE INDEX index_forum_topics_on_text_index ON public.forum_topics USING gin (
CREATE INDEX index_forum_topics_on_updated_at ON public.forum_topics USING btree (updated_at);
--
-- Name: index_ip_bans_on_category; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_ip_bans_on_category ON public.ip_bans USING btree (category);
--
-- Name: index_ip_bans_on_ip_addr; Type: INDEX; Schema: public; Owner: -
--
@@ -6435,6 +6446,13 @@ CREATE INDEX index_forum_topics_on_updated_at ON public.forum_topics USING btree
CREATE INDEX index_ip_bans_on_ip_addr ON public.ip_bans USING btree (ip_addr);
--
-- Name: index_ip_bans_on_is_deleted; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_ip_bans_on_is_deleted ON public.ip_bans USING btree (is_deleted);
--
-- Name: index_mod_actions_on_created_at; Type: INDEX; Schema: public; Owner: -
--
@@ -7365,6 +7383,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20200318224633'),
('20200325073456'),
('20200325074859'),
('20200403210353');
('20200403210353'),
('20200406054838');