about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2020-01-13 21:57:24 -0600
committermultiple creatures <dev@multiple-creature.party>2020-01-13 21:57:24 -0600
commit67516a07db44196cc4bb94bf94abe5c6f611cf07 (patch)
treef65b7c79f859329a0438d806e777fa1d7aa7f400 /db
parent1fbe7c340201ddff5232c7931a265136943ffd59 (diff)
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
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200114011918_create_defederating_statuses.rb9
-rw-r--r--db/migrate/20200114030940_add_unique_indexes_on_defederating_and_destructing_statuses.rb11
-rw-r--r--db/structure.sql73
3 files changed, 91 insertions, 2 deletions
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
@@ -897,6 +897,36 @@ 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: -
 --
 
@@ -2624,6 +2654,13 @@ ALTER TABLE ONLY public.custom_filters ALTER COLUMN id SET DEFAULT nextval('publ
 
 
 --
+-- 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: -
 --
 
@@ -3085,6 +3122,14 @@ ALTER TABLE ONLY public.custom_filters
 
 
 --
+-- 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: -
 --
 
@@ -3697,6 +3742,20 @@ CREATE INDEX index_custom_filters_on_account_id ON public.custom_filters USING b
 
 
 --
+-- 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);
 
 
 --
@@ -4980,6 +5039,14 @@ ALTER TABLE ONLY public.account_warnings
 
 
 --
+-- 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');