diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2020-04-15 20:33:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-15 20:33:24 +0200 |
commit | 5edff32733eff2cbffbf614b31eea85da8dc3aaf (patch) | |
tree | b0ab38cbf8793f47017e2151de5dd32bdd83a29a /db | |
parent | 5524258da9bc1d62b1396d19c672d3a8335ffbc5 (diff) |
Change delivery failure tracking to work with hostnames instead of URLs (#13437)
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20200407201300_create_unavailable_domains.rb | 9 | ||||
-rw-r--r-- | db/migrate/20200407202420_migrate_unavailable_inboxes.rb | 16 | ||||
-rw-r--r-- | db/schema.rb | 9 |
3 files changed, 33 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..0dce26c6f --- /dev/null +++ b/db/migrate/20200407202420_migrate_unavailable_inboxes.rb @@ -0,0 +1,16 @@ +class MigrateUnavailableInboxes < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + def up + urls = Redis.current.smembers('unavailable_inboxes') + + urls.each do |url| + host = Addressable::URI.parse(url).normalized_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/schema.rb b/db/schema.rb index 021ddac89..54e81bd3f 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_07_202420) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -769,6 +769,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" |