about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-11-09 11:30:28 +0100
committerGitHub <noreply@github.com>2020-11-09 11:30:28 +0100
commit67125534bc0fd48a45d6cb17a5c78712d8e87150 (patch)
treeb718c8b54a0bd63eab69abaef2267c8f0aa9a9b9 /db
parentcfb16b9b70a50ec5451c9aebb2c35d3a44701311 (diff)
parentecd83f495c18486bc7ea901423f6fccfd910b277 (diff)
Merge pull request #1454 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20201017233919_add_suspension_origin_to_accounts.rb5
-rw-r--r--db/post_migrate/20201017234926_fill_account_suspension_origin.rb11
-rw-r--r--db/schema.rb3
3 files changed, 18 insertions, 1 deletions
diff --git a/db/migrate/20201017233919_add_suspension_origin_to_accounts.rb b/db/migrate/20201017233919_add_suspension_origin_to_accounts.rb
new file mode 100644
index 000000000..f0db02143
--- /dev/null
+++ b/db/migrate/20201017233919_add_suspension_origin_to_accounts.rb
@@ -0,0 +1,5 @@
+class AddSuspensionOriginToAccounts < ActiveRecord::Migration[5.2]
+  def change
+    add_column :accounts, :suspension_origin, :integer
+  end
+end
diff --git a/db/post_migrate/20201017234926_fill_account_suspension_origin.rb b/db/post_migrate/20201017234926_fill_account_suspension_origin.rb
new file mode 100644
index 000000000..ab7407d79
--- /dev/null
+++ b/db/post_migrate/20201017234926_fill_account_suspension_origin.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class FillAccountSuspensionOrigin < ActiveRecord::Migration[5.2]
+  disable_ddl_transaction!
+
+  def up
+    Account.suspended.where(suspension_origin: nil).in_batches.update_all(suspension_origin: :local)
+  end
+
+  def down; end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 6d721d63e..7d39126f0 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: 2020_10_08_220312) do
+ActiveRecord::Schema.define(version: 2020_10_17_234926) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -189,6 +189,7 @@ ActiveRecord::Schema.define(version: 2020_10_08_220312) do
     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.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