about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authorStarfall <root@starfall.blue>2020-05-10 02:59:07 -0500
committerStarfall <root@starfall.blue>2020-05-10 02:59:07 -0500
commit77fa1183cc113e3d3d20140e3545443cf6c7f170 (patch)
tree2ce4e4dd5235999d163350779f18cf74fe1ff0d1 /db
parentb107e4f771f036b214563764fcd95786f8016ee7 (diff)
parentc6ff4c634caf718adf7280e04909c091d15add1d (diff)
Merge branch 'glitch'
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200407201300_create_unavailable_domains.rb9
-rw-r--r--db/migrate/20200407202420_migrate_unavailable_inboxes.rb21
-rw-r--r--db/migrate/20200417125749_add_storage_schema_version.rb9
-rw-r--r--db/schema.rb14
4 files changed, 52 insertions, 1 deletions
diff --git a/db/migrate/20200407201300_create_unavailable_domains.rb b/db/migrate/20200407201300_create_unavailable_domains.rb
new file mode 100644
index 000000000..56b477da5
--- /dev/null
+++ b/db/migrate/20200407201300_create_unavailable_domains.rb
@@ -0,0 +1,9 @@
+class CreateUnavailableDomains < ActiveRecord::Migration[5.2]
+  def change
+    create_table :unavailable_domains do |t|
+      t.string :domain, default: '', null: false, index: { unique: true }
+
+      t.timestamps
+    end
+  end
+end
diff --git a/db/migrate/20200407202420_migrate_unavailable_inboxes.rb b/db/migrate/20200407202420_migrate_unavailable_inboxes.rb
new file mode 100644
index 000000000..92a3acb5d
--- /dev/null
+++ b/db/migrate/20200407202420_migrate_unavailable_inboxes.rb
@@ -0,0 +1,21 @@
+class MigrateUnavailableInboxes < ActiveRecord::Migration[5.2]
+  disable_ddl_transaction!
+
+  def up
+    urls = Redis.current.smembers('unavailable_inboxes')
+
+    hosts = urls.map do |url|
+      Addressable::URI.parse(url).normalized_host
+    end.compact.uniq
+
+    UnavailableDomain.delete_all
+
+    hosts.each do |host|
+      UnavailableDomain.create(domain: host)
+    end
+
+    Redis.current.del(*(['unavailable_inboxes'] + Redis.current.keys('exhausted_deliveries:*')))
+  end
+
+  def down; end
+end
diff --git a/db/migrate/20200417125749_add_storage_schema_version.rb b/db/migrate/20200417125749_add_storage_schema_version.rb
new file mode 100644
index 000000000..7438f97ba
--- /dev/null
+++ b/db/migrate/20200417125749_add_storage_schema_version.rb
@@ -0,0 +1,9 @@
+class AddStorageSchemaVersion < ActiveRecord::Migration[5.2]
+  def change
+    add_column :preview_cards, :image_storage_schema_version, :integer
+    add_column :accounts, :avatar_storage_schema_version, :integer
+    add_column :accounts, :header_storage_schema_version, :integer
+    add_column :media_attachments, :file_storage_schema_version, :integer
+    add_column :custom_emojis, :image_storage_schema_version, :integer
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index c294d762b..2b27a1877 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_03_12_185443) do
+ActiveRecord::Schema.define(version: 2020_04_17_125749) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -172,6 +172,8 @@ ActiveRecord::Schema.define(version: 2020_03_12_185443) do
     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.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), lower((domain)::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"
@@ -299,6 +301,7 @@ ActiveRecord::Schema.define(version: 2020_03_12_185443) do
     t.string "image_remote_url"
     t.boolean "visible_in_picker", default: true, null: false
     t.bigint "category_id"
+    t.integer "image_storage_schema_version"
     t.index ["shortcode", "domain"], name: "index_custom_emojis_on_shortcode_and_domain", unique: true
   end
 
@@ -465,6 +468,7 @@ ActiveRecord::Schema.define(version: 2020_03_12_185443) do
     t.bigint "scheduled_status_id"
     t.string "blurhash"
     t.integer "processing"
+    t.integer "file_storage_schema_version"
     t.index ["account_id"], name: "index_media_attachments_on_account_id"
     t.index ["scheduled_status_id"], name: "index_media_attachments_on_scheduled_status_id"
     t.index ["shortcode"], name: "index_media_attachments_on_shortcode", unique: true
@@ -605,6 +609,7 @@ ActiveRecord::Schema.define(version: 2020_03_12_185443) do
     t.datetime "created_at", null: false
     t.datetime "updated_at", null: false
     t.string "embed_url", default: "", null: false
+    t.integer "image_storage_schema_version"
     t.index ["url"], name: "index_preview_cards_on_url", unique: true
   end
 
@@ -772,6 +777,13 @@ ActiveRecord::Schema.define(version: 2020_03_12_185443) do
     t.index ["uri"], name: "index_tombstones_on_uri"
   end
 
+  create_table "unavailable_domains", force: :cascade do |t|
+    t.string "domain", default: "", null: false
+    t.datetime "created_at", null: false
+    t.datetime "updated_at", null: false
+    t.index ["domain"], name: "index_unavailable_domains_on_domain", unique: true
+  end
+
   create_table "user_invite_requests", force: :cascade do |t|
     t.bigint "user_id"
     t.text "text"