about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2022-03-08 17:55:38 -0600
committerStarfall <us@starfall.systems>2022-03-08 17:55:38 -0600
commit239d67fc2c0ec82617de50a9831bc1a9efc30ecc (patch)
treea6806025fe9e094994366434b08093cee5923557 /db
parentad1733ea294c6049336a9aeeb7ff96c8fea22cfa (diff)
parent02133866e6915e37431298b396e1aded1e4c44c5 (diff)
Merge remote-tracking branch 'glitch/main'
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20170920032311_fix_reblogs_in_feeds.rb2
-rw-r--r--db/migrate/20180608213548_reject_following_blocked_users.rb6
-rw-r--r--db/migrate/20220202200743_add_trendable_to_accounts.rb7
-rw-r--r--db/migrate/20220202200926_add_trendable_to_statuses.rb5
-rw-r--r--db/migrate/20220224010024_add_ips_to_email_domain_blocks.rb6
-rw-r--r--db/migrate/20220227041951_add_last_used_at_to_oauth_access_tokens.rb6
-rw-r--r--db/migrate/20220304195405_migrate_hide_network_preference.rb37
-rw-r--r--db/post_migrate/20220202201015_remove_trust_level_from_accounts.rb9
-rw-r--r--db/schema.rb13
9 files changed, 84 insertions, 7 deletions
diff --git a/db/migrate/20170920032311_fix_reblogs_in_feeds.rb b/db/migrate/20170920032311_fix_reblogs_in_feeds.rb
index bcd4b9137..4ab68e8f3 100644
--- a/db/migrate/20170920032311_fix_reblogs_in_feeds.rb
+++ b/db/migrate/20170920032311_fix_reblogs_in_feeds.rb
@@ -16,7 +16,7 @@ class FixReblogsInFeeds < ActiveRecord::Migration[5.1]
     # is once again set to the reblogging status' ID, and the value
     # is set to the reblogged status' ID). This is safe for Redis'
     # float conversion because in this reblog tracking zset, we only
-    # need the rebloggging status' ID to be able to stop tracking
+    # need the reblogging status' ID to be able to stop tracking
     # entries after they have gotten too far down the feed, which
     # does not require an exact value.
 
diff --git a/db/migrate/20180608213548_reject_following_blocked_users.rb b/db/migrate/20180608213548_reject_following_blocked_users.rb
index 302db6b68..78f8df538 100644
--- a/db/migrate/20180608213548_reject_following_blocked_users.rb
+++ b/db/migrate/20180608213548_reject_following_blocked_users.rb
@@ -22,13 +22,13 @@ class RejectFollowingBlockedUsers < ActiveRecord::Migration[5.2]
 
     follows.each do |follow|
       blocked_account = follow.account
-      followed_acccount = follow.target_account
+      followed_account = follow.target_account
 
       next follow.destroy! if blocked_account.local?
 
-      reject_follow_json = Oj.dump(ActivityPub::LinkedDataSignature.new(ActiveModelSerializers::SerializableResource.new(follow, serializer: ActivityPub::RejectFollowSerializer, adapter: ActivityPub::Adapter).as_json).sign!(followed_acccount))
+      reject_follow_json = Oj.dump(ActivityPub::LinkedDataSignature.new(ActiveModelSerializers::SerializableResource.new(follow, serializer: ActivityPub::RejectFollowSerializer, adapter: ActivityPub::Adapter).as_json).sign!(followed_account))
 
-      ActivityPub::DeliveryWorker.perform_async(reject_follow_json, followed_acccount, blocked_account.inbox_url)
+      ActivityPub::DeliveryWorker.perform_async(reject_follow_json, followed_account, blocked_account.inbox_url)
 
       follow.destroy!
     end
diff --git a/db/migrate/20220202200743_add_trendable_to_accounts.rb b/db/migrate/20220202200743_add_trendable_to_accounts.rb
new file mode 100644
index 000000000..414df5108
--- /dev/null
+++ b/db/migrate/20220202200743_add_trendable_to_accounts.rb
@@ -0,0 +1,7 @@
+class AddTrendableToAccounts < ActiveRecord::Migration[6.1]
+  def change
+    add_column :accounts, :trendable, :boolean
+    add_column :accounts, :reviewed_at, :datetime
+    add_column :accounts, :requested_review_at, :datetime
+  end
+end
diff --git a/db/migrate/20220202200926_add_trendable_to_statuses.rb b/db/migrate/20220202200926_add_trendable_to_statuses.rb
new file mode 100644
index 000000000..7f38c8ca7
--- /dev/null
+++ b/db/migrate/20220202200926_add_trendable_to_statuses.rb
@@ -0,0 +1,5 @@
+class AddTrendableToStatuses < ActiveRecord::Migration[6.1]
+  def change
+    add_column :statuses, :trendable, :boolean
+  end
+end
diff --git a/db/migrate/20220224010024_add_ips_to_email_domain_blocks.rb b/db/migrate/20220224010024_add_ips_to_email_domain_blocks.rb
new file mode 100644
index 000000000..1b19a2aa1
--- /dev/null
+++ b/db/migrate/20220224010024_add_ips_to_email_domain_blocks.rb
@@ -0,0 +1,6 @@
+class AddIpsToEmailDomainBlocks < ActiveRecord::Migration[6.1]
+  def change
+    add_column :email_domain_blocks, :ips, :inet, array: true
+    add_column :email_domain_blocks, :last_refresh_at, :datetime
+  end
+end
diff --git a/db/migrate/20220227041951_add_last_used_at_to_oauth_access_tokens.rb b/db/migrate/20220227041951_add_last_used_at_to_oauth_access_tokens.rb
new file mode 100644
index 000000000..6b46e60a8
--- /dev/null
+++ b/db/migrate/20220227041951_add_last_used_at_to_oauth_access_tokens.rb
@@ -0,0 +1,6 @@
+class AddLastUsedAtToOauthAccessTokens < ActiveRecord::Migration[6.1]
+  def change
+    add_column :oauth_access_tokens, :last_used_at, :datetime
+    add_column :oauth_access_tokens, :last_used_ip, :inet
+  end
+end
diff --git a/db/migrate/20220304195405_migrate_hide_network_preference.rb b/db/migrate/20220304195405_migrate_hide_network_preference.rb
new file mode 100644
index 000000000..102ee46d6
--- /dev/null
+++ b/db/migrate/20220304195405_migrate_hide_network_preference.rb
@@ -0,0 +1,37 @@
+class MigrateHideNetworkPreference < ActiveRecord::Migration[6.1]
+  disable_ddl_transaction!
+
+  # Dummy classes, to make migration possible across version changes
+  class Account < ApplicationRecord
+    has_one :user, inverse_of: :account
+    scope :local, -> { where(domain: nil) }
+  end
+
+  class User < ApplicationRecord
+    belongs_to :account
+  end
+
+  def up
+    Account.reset_column_information
+
+    Setting.unscoped.where(thing_type: 'User', var: 'hide_network').find_each do |setting|
+      account = User.find(setting.thing_id).account
+
+      ApplicationRecord.transaction do
+        account.update(hide_collections: setting.value)
+        setting.delete
+      end
+    rescue ActiveRecord::RecordNotFound
+      next
+    end
+  end
+
+  def down
+    Account.local.where(hide_collections: true).includes(:user).find_each do |account|
+      ApplicationRecord.transaction do
+        Setting.create(thing_type: 'User', thing_id: account.user.id, var: 'hide_network', value: account.hide_collections?)
+        account.update(hide_collections: nil)
+      end
+    end
+  end
+end
diff --git a/db/post_migrate/20220202201015_remove_trust_level_from_accounts.rb b/db/post_migrate/20220202201015_remove_trust_level_from_accounts.rb
new file mode 100644
index 000000000..d5d995ece
--- /dev/null
+++ b/db/post_migrate/20220202201015_remove_trust_level_from_accounts.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class RemoveTrustLevelFromAccounts < ActiveRecord::Migration[5.2]
+  disable_ddl_transaction!
+
+  def change
+    safety_assured { remove_column :accounts, :trust_level, :integer }
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index e27e04b71..f8d85901d 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
 #
 # It's strongly recommended that you check this file into your version control system.
 
-ActiveRecord::Schema.define(version: 2022_02_10_153119) do
+ActiveRecord::Schema.define(version: 2022_03_04_195405) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -177,13 +177,15 @@ ActiveRecord::Schema.define(version: 2022_02_10_153119) do
     t.string "also_known_as", array: true
     t.datetime "silenced_at"
     t.datetime "suspended_at"
-    t.integer "trust_level"
     t.boolean "hide_collections"
     t.integer "avatar_storage_schema_version"
     t.integer "header_storage_schema_version"
     t.string "devices_url"
     t.integer "suspension_origin"
     t.datetime "sensitized_at"
+    t.boolean "trendable"
+    t.datetime "reviewed_at"
+    t.datetime "requested_review_at"
     t.index "(((setweight(to_tsvector('simple'::regconfig, (display_name)::text), 'A'::\"char\") || setweight(to_tsvector('simple'::regconfig, (username)::text), 'B'::\"char\")) || setweight(to_tsvector('simple'::regconfig, (COALESCE(domain, ''::character varying))::text), 'C'::\"char\")))", name: "search_index", using: :gin
     t.index "lower((username)::text), COALESCE(lower((domain)::text), ''::text)", name: "index_accounts_on_username_and_domain_lower", unique: true
     t.index ["moved_to_account_id"], name: "index_accounts_on_moved_to_account_id"
@@ -387,6 +389,9 @@ ActiveRecord::Schema.define(version: 2022_02_10_153119) do
     t.datetime "created_at", null: false
     t.datetime "updated_at", null: false
     t.bigint "parent_id"
+    t.inet "ips", array: true
+    t.datetime "last_refresh_at"
+
     t.index ["domain"], name: "index_email_domain_blocks_on_domain", unique: true
   end
 
@@ -625,6 +630,8 @@ ActiveRecord::Schema.define(version: 2022_02_10_153119) do
     t.string "scopes"
     t.bigint "application_id"
     t.bigint "resource_owner_id"
+    t.datetime "last_used_at"
+    t.inet "last_used_ip"
     t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true
     t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id"
     t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true
@@ -887,6 +894,7 @@ ActiveRecord::Schema.define(version: 2022_02_10_153119) do
     t.string "content_type"
     t.datetime "deleted_at"
     t.datetime "edited_at"
+    t.boolean "trendable"
     t.index ["account_id", "id", "visibility", "updated_at"], name: "index_statuses_20190820", order: { id: :desc }, where: "(deleted_at IS NULL)"
     t.index ["deleted_at"], name: "index_statuses_on_deleted_at", where: "(deleted_at IS NOT NULL)"
     t.index ["id", "account_id"], name: "index_statuses_local_20190824", order: { id: :desc }, where: "((local OR (uri IS NULL)) AND (deleted_at IS NULL) AND (visibility = 0) AND (reblog_of_id IS NULL) AND ((NOT reply) OR (in_reply_to_account_id = account_id)))"
@@ -1228,5 +1236,4 @@ ActiveRecord::Schema.define(version: 2022_02_10_153119) do
     ORDER BY (sum(t0.rank)) DESC;
   SQL
   add_index "follow_recommendations", ["account_id"], name: "index_follow_recommendations_on_account_id", unique: true
-
 end