From 67516a07db44196cc4bb94bf94abe5c6f611cf07 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Mon, 13 Jan 2020 21:57:24 -0600 Subject: add new privacy option to auto-defederate after a given timespan + add options to defederate and/or delete past posts + add `defed_in`/`parent:defed_in`/`thread:defed_in` bangtags + ui indicator for posts marked for auto-defederation --- .../20200114011918_create_defederating_statuses.rb | 9 +++ ...xes_on_defederating_and_destructing_statuses.rb | 11 ++++ db/structure.sql | 73 +++++++++++++++++++++- 3 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20200114011918_create_defederating_statuses.rb create mode 100644 db/migrate/20200114030940_add_unique_indexes_on_defederating_and_destructing_statuses.rb (limited to 'db') diff --git a/db/migrate/20200114011918_create_defederating_statuses.rb b/db/migrate/20200114011918_create_defederating_statuses.rb new file mode 100644 index 000000000..55fc7f900 --- /dev/null +++ b/db/migrate/20200114011918_create_defederating_statuses.rb @@ -0,0 +1,9 @@ +class CreateDefederatingStatuses < ActiveRecord::Migration[5.2] + def change + create_table :defederating_statuses do |t| + t.references :status, foreign_key: true + t.datetime :defederate_after + end + safety_assured { add_index :defederating_statuses, :defederate_after } + end +end diff --git a/db/migrate/20200114030940_add_unique_indexes_on_defederating_and_destructing_statuses.rb b/db/migrate/20200114030940_add_unique_indexes_on_defederating_and_destructing_statuses.rb new file mode 100644 index 000000000..6ad8f8b52 --- /dev/null +++ b/db/migrate/20200114030940_add_unique_indexes_on_defederating_and_destructing_statuses.rb @@ -0,0 +1,11 @@ +class AddUniqueIndexesOnDefederatingAndDestructingStatuses < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + def change + remove_index :destructing_statuses, :status_id + remove_index :defederating_statuses, :status_id + + add_index :destructing_statuses, :status_id, unique: true, algorithm: :concurrently + add_index :defederating_statuses, :status_id, unique: true, algorithm: :concurrently + end +end diff --git a/db/structure.sql b/db/structure.sql index 6002bec8c..06dafb256 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -896,6 +896,36 @@ CREATE SEQUENCE public.custom_filters_id_seq ALTER SEQUENCE public.custom_filters_id_seq OWNED BY public.custom_filters.id; +-- +-- Name: defederating_statuses; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.defederating_statuses ( + id bigint NOT NULL, + status_id bigint, + defederate_after timestamp without time zone +); + + +-- +-- Name: defederating_statuses_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.defederating_statuses_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: defederating_statuses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.defederating_statuses_id_seq OWNED BY public.defederating_statuses.id; + + -- -- Name: destructing_statuses; Type: TABLE; Schema: public; Owner: - -- @@ -2623,6 +2653,13 @@ ALTER TABLE ONLY public.custom_emojis ALTER COLUMN id SET DEFAULT nextval('publi ALTER TABLE ONLY public.custom_filters ALTER COLUMN id SET DEFAULT nextval('public.custom_filters_id_seq'::regclass); +-- +-- Name: defederating_statuses id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.defederating_statuses ALTER COLUMN id SET DEFAULT nextval('public.defederating_statuses_id_seq'::regclass); + + -- -- Name: destructing_statuses id; Type: DEFAULT; Schema: public; Owner: - -- @@ -3084,6 +3121,14 @@ ALTER TABLE ONLY public.custom_filters ADD CONSTRAINT custom_filters_pkey PRIMARY KEY (id); +-- +-- Name: defederating_statuses defederating_statuses_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.defederating_statuses + ADD CONSTRAINT defederating_statuses_pkey PRIMARY KEY (id); + + -- -- Name: destructing_statuses destructing_statuses_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -3696,6 +3741,20 @@ CREATE UNIQUE INDEX index_custom_emojis_on_shortcode_and_domain ON public.custom CREATE INDEX index_custom_filters_on_account_id ON public.custom_filters USING btree (account_id); +-- +-- Name: index_defederating_statuses_on_defederate_after; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_defederating_statuses_on_defederate_after ON public.defederating_statuses USING btree (defederate_after); + + +-- +-- Name: index_defederating_statuses_on_status_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_defederating_statuses_on_status_id ON public.defederating_statuses USING btree (status_id); + + -- -- Name: index_destructing_statuses_on_delete_after; Type: INDEX; Schema: public; Owner: - -- @@ -3707,7 +3766,7 @@ CREATE INDEX index_destructing_statuses_on_delete_after ON public.destructing_st -- Name: index_destructing_statuses_on_status_id; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX index_destructing_statuses_on_status_id ON public.destructing_statuses USING btree (status_id); +CREATE UNIQUE INDEX index_destructing_statuses_on_status_id ON public.destructing_statuses USING btree (status_id); -- @@ -4979,6 +5038,14 @@ ALTER TABLE ONLY public.account_warnings ADD CONSTRAINT fk_rails_a7ebbb1e37 FOREIGN KEY (target_account_id) REFERENCES public.accounts(id) ON DELETE CASCADE; +-- +-- Name: defederating_statuses fk_rails_af4e2f2cab; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.defederating_statuses + ADD CONSTRAINT fk_rails_af4e2f2cab FOREIGN KEY (status_id) REFERENCES public.statuses(id); + + -- -- Name: web_push_subscriptions fk_rails_b006f28dac; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -5399,6 +5466,8 @@ INSERT INTO "schema_migrations" (version) VALUES ('20200110214031'), ('20200110221801'), ('20200110221920'), -('20200111042543'); +('20200111042543'), +('20200114011918'), +('20200114030940'); -- cgit