about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2020-01-10 20:07:15 -0600
committermultiple creatures <dev@multiple-creature.party>2020-01-10 20:07:15 -0600
commit1268277a8c203bcae515e0ccc8b3432119bafed2 (patch)
tree89fccc698a4a148f70a3ae10faf0ffef260200ec /db
parent0090aca0453285ed6f4d55758ccd05200025d11a (diff)
add custom filter master toggle, add media gallery mode, & fix various filter logic + caching bugs
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200110202317_add_media_only_mode.rb5
-rw-r--r--db/migrate/20200110213720_add_filter_undescribed_to_users.rb7
-rw-r--r--db/migrate/20200110214031_migrate_filter_undescribed_from_accounts.rb17
-rw-r--r--db/migrate/20200110221801_add_filters_enabled_to_users.rb7
-rw-r--r--db/migrate/20200110221920_enable_filters_if_filters_exist.rb7
-rw-r--r--db/structure.sql15
6 files changed, 54 insertions, 4 deletions
diff --git a/db/migrate/20200110202317_add_media_only_mode.rb b/db/migrate/20200110202317_add_media_only_mode.rb
new file mode 100644
index 000000000..93934623a
--- /dev/null
+++ b/db/migrate/20200110202317_add_media_only_mode.rb
@@ -0,0 +1,5 @@
+class AddMediaOnlyMode < ActiveRecord::Migration[5.2]
+  def change
+    safety_assured { add_column :users, :media_only, :boolean, null: false, default: false }
+  end
+end
diff --git a/db/migrate/20200110213720_add_filter_undescribed_to_users.rb b/db/migrate/20200110213720_add_filter_undescribed_to_users.rb
new file mode 100644
index 000000000..e97f28e96
--- /dev/null
+++ b/db/migrate/20200110213720_add_filter_undescribed_to_users.rb
@@ -0,0 +1,7 @@
+class AddFilterUndescribedToUsers < ActiveRecord::Migration[5.2]
+  def change
+    safety_assured {
+      add_column :users, :filter_undescribed, :boolean, null: false, default: false
+    }
+  end
+end
diff --git a/db/migrate/20200110214031_migrate_filter_undescribed_from_accounts.rb b/db/migrate/20200110214031_migrate_filter_undescribed_from_accounts.rb
new file mode 100644
index 000000000..6e29b9d44
--- /dev/null
+++ b/db/migrate/20200110214031_migrate_filter_undescribed_from_accounts.rb
@@ -0,0 +1,17 @@
+class MigrateFilterUndescribedFromAccounts < ActiveRecord::Migration[5.2]
+  def up
+    Account.local.find_each do |account|
+      account.user.update!(filter_undescribed: account.filter_undescribed)
+    end
+    safety_assured {
+      remove_column :accounts, :filter_undescribed
+    }
+  end
+
+  def down
+    return true
+    safety_assured {
+      add_column :accounts, :filter_undescribed, :boolean, null: true, default: false
+    }
+  end
+end
diff --git a/db/migrate/20200110221801_add_filters_enabled_to_users.rb b/db/migrate/20200110221801_add_filters_enabled_to_users.rb
new file mode 100644
index 000000000..db15015e7
--- /dev/null
+++ b/db/migrate/20200110221801_add_filters_enabled_to_users.rb
@@ -0,0 +1,7 @@
+class AddFiltersEnabledToUsers < ActiveRecord::Migration[5.2]
+  def change
+    safety_assured do
+      add_column :users, :filters_enabled, :boolean, null: false, default: false
+    end
+  end
+end
diff --git a/db/migrate/20200110221920_enable_filters_if_filters_exist.rb b/db/migrate/20200110221920_enable_filters_if_filters_exist.rb
new file mode 100644
index 000000000..68758a9ef
--- /dev/null
+++ b/db/migrate/20200110221920_enable_filters_if_filters_exist.rb
@@ -0,0 +1,7 @@
+class EnableFiltersIfFiltersExist < ActiveRecord::Migration[5.2]
+  def up
+    Account.local.find_each do |account|
+      account.user.update!(filters_enabled: !account.custom_filters.enabled.blank?)
+    end
+  end
+end
diff --git a/db/structure.sql b/db/structure.sql
index de17e54f8..e3da0e923 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -550,8 +550,7 @@ CREATE TABLE public.accounts (
     known boolean DEFAULT false NOT NULL,
     force_private boolean DEFAULT false NOT NULL,
     unboostable boolean DEFAULT false NOT NULL,
-    block_anon boolean DEFAULT false NOT NULL,
-    filter_undescribed boolean DEFAULT false NOT NULL
+    block_anon boolean DEFAULT false NOT NULL
 );
 
 
@@ -2396,7 +2395,10 @@ CREATE TABLE public.users (
     hide_boosts boolean,
     only_known boolean,
     invert_filters boolean DEFAULT false NOT NULL,
-    filter_timelines_only boolean DEFAULT false NOT NULL
+    filter_timelines_only boolean DEFAULT false NOT NULL,
+    media_only boolean DEFAULT false NOT NULL,
+    filter_undescribed boolean DEFAULT false NOT NULL,
+    filters_enabled boolean DEFAULT false NOT NULL
 );
 
 
@@ -5390,6 +5392,11 @@ INSERT INTO "schema_migrations" (version) VALUES
 ('20200108051211'),
 ('20200109191740'),
 ('20200110072034'),
-('20200110195612');
+('20200110195612'),
+('20200110202317'),
+('20200110213720'),
+('20200110214031'),
+('20200110221801'),
+('20200110221920');