about summary refs log tree commit diff
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2020-01-10 03:45:29 -0600
committermultiple creatures <dev@multiple-creature.party>2020-01-10 03:45:29 -0600
commitf03960382bd05b8570e0e3b1066545831c59138a (patch)
treee7f4b362018e17e2a475a9c2e6988b0ebd79ac5d
parent4c8591fbeae9054a354f955e37a95aeed369222a (diff)
switch (back) to postgres fts engine for fast search & timeline filters
-rw-r--r--app/helpers/filter_helper.rb2
-rw-r--r--app/helpers/search_helper.rb20
-rw-r--r--app/lib/bangtags.rb3
-rw-r--r--app/models/normalized_status.rb13
-rw-r--r--app/models/status.rb23
-rw-r--r--config/locales/simple_form.en.yml4
-rw-r--r--db/migrate/20191211235208_create_normalized_statuses.rb23
-rw-r--r--db/migrate/20200109191740_migrate_back_to_fts.rb42
-rw-r--r--db/migrate/20200110072034_add_index_to_tsv.rb15
-rw-r--r--db/structure.sql5382
-rw-r--r--spec/fabricators/normalized_status_fabricator.rb4
-rw-r--r--spec/models/normalized_status_spec.rb5
-rw-r--r--streaming/index.js2
13 files changed, 5455 insertions, 83 deletions
diff --git a/app/helpers/filter_helper.rb b/app/helpers/filter_helper.rb
index db2652557..b9dbc1f4f 100644
--- a/app/helpers/filter_helper.rb
+++ b/app/helpers/filter_helper.rb
@@ -7,7 +7,7 @@ module FilterHelper
 
     status = status.reblog if status.reblog?
 
-    if Status.where(id: status.id).regex_filtered_by_account(receiver_id).exists?
+    if Status.where(id: status.id).search_filtered_by_account(receiver_id).exists?
       redis.sadd("filtered_statuses:#{receiver_id}", status.id)
       return true
     end
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
deleted file mode 100644
index 8bddbe187..000000000
--- a/app/helpers/search_helper.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-require 'sixarm_ruby_unaccent'
-
-module SearchHelper
-	def expand_search_query(query)
-    return '' if query.blank?
-    query = query.downcase.unaccent.gsub(/[^\p{Word} [:punct:]]/, '').gsub(/  +/, ' ').strip
-    return '' if query.blank?
-
-    if query.include?(':')
-      query_parts = query.split(':', 2)
-      if %w(tag tags).include?(query_parts[0])
-        query = "^tag (#{query_parts[1].split.join('|')})"
-      elsif %w(subj text desc).include?(query_parts[0])
-        query = "^#{query_parts[0]} .*#{query_parts[1]}"
-      end
-    end
-
-    query.gsub(/"(.*)"/, '\\y\1\\y')
-  end
-end
diff --git a/app/lib/bangtags.rb b/app/lib/bangtags.rb
index a3874c128..9fec00d9d 100644
--- a/app/lib/bangtags.rb
+++ b/app/lib/bangtags.rb
@@ -3,7 +3,6 @@
 class Bangtags
   include ModerationHelper
   include ServiceAccountHelper
-  include SearchHelper
 
   attr_reader :status, :account
 
@@ -764,7 +763,7 @@ class Bangtags
           q = cmd[1..-1].join.strip
           next if q.blank?
           begin
-            data = @account.statuses.regex(expand_search_query(q))
+            data = @account.statuses.search(q.unaccent)
               .reorder(:created_at)
               .pluck(:created_at)
               .map { |d| d.strftime('%Y-%m') }
diff --git a/app/models/normalized_status.rb b/app/models/normalized_status.rb
deleted file mode 100644
index ad1ffaffc..000000000
--- a/app/models/normalized_status.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# == Schema Information
-#
-# Table name: normalized_statuses
-#
-#  id        :bigint(8)        not null, primary key
-#  status_id :bigint(8)
-#  text      :text
-#
-
-class NormalizedStatus < ApplicationRecord
-  belongs_to :status, inverse_of: :normalized_status
-  validates_uniqueness_of :status_id
-end
diff --git a/app/models/status.rb b/app/models/status.rb
index f4c90fea2..d051d8962 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -30,6 +30,7 @@
 #  edited                 :boolean
 #  boostable              :boolean
 #  reject_replies         :boolean
+#  tsv                    :tsvector
 #
 
 class Status < ApplicationRecord
@@ -82,7 +83,6 @@ class Status < ApplicationRecord
   has_one :status_stat, inverse_of: :status
   has_one :poll, inverse_of: :status, dependent: :destroy
   has_one :destructing_status, inverse_of: :status, dependent: :destroy
-  has_one :normalized_status, inverse_of: :status, dependent: :destroy
   has_one :imported_status, inverse_of: :status, dependent: :destroy
   has_one :sharekey, inverse_of: :status, dependent: :destroy
 
@@ -118,10 +118,10 @@ class Status < ApplicationRecord
   scope :mention_not_excluded_by_account, ->(account) { left_outer_joins(:mentions).where('mentions.account_id IS NULL OR mentions.account_id NOT IN (?)', account.excluded_from_timeline_account_ids) }
   scope :not_domain_blocked_by_account, ->(account) { account.excluded_from_timeline_domains.blank? ? left_outer_joins(:account) : left_outer_joins(:account).where('accounts.domain IS NULL OR accounts.domain NOT IN (?)', account.excluded_from_timeline_domains) }
 
-  scope :like, ->(needle) { joins(:normalized_status).select('statuses.*').where('normalized_statuses.text LIKE f_normalize(?)', needle) }
-  scope :regex, ->(needle) { joins(:normalized_status).select('statuses.*').where('normalized_statuses.text ~ f_normalize(?)', needle) }
-  scope :regex_filtered_by_account, ->(account_id) { joins(:normalized_status).select('statuses.*').where('normalized_statuses.text ~ ANY(ARRAY(SELECT f_normalize(phrase) FROM custom_filters WHERE account_id = ?))', account_id) }
-  scope :regex_not_filtered_by_account, ->(account_id) { joins(:normalized_status).select('statuses.*').where('normalized_statuses.text !~ ALL(ARRAY(SELECT f_normalize(phrase) FROM custom_filters WHERE account_id = ?))', account_id) }
+  scope :search, ->(needle) { where("tsv @@ websearch_to_tsquery('fedi', ?)", needle) }
+  scope :search_not, ->(needle) { where.not("tsv @@ websearch_to_tsquery('fedi', ?)", needle) }
+  scope :search_filtered_by_account, ->(account_id) { where('tsv @@ (SELECT tsquery_union(websearch_to_tsquery(phrase)) FROM custom_filters WHERE account_id = ?)', account_id) }
+  scope :search_not_filtered_by_account, ->(account_id) { where.not('tsv @@ (SELECT tsquery_union(websearch_to_tsquery(phrase)) FROM custom_filters WHERE account_id = ?)', account_id) }
 
   scope :not_missing_media_desc, -> { left_outer_joins(:media_attachments).select('statuses.*').where('media_attachments.id IS NULL OR media_attachments.description IS NOT NULL') }
 
@@ -362,8 +362,6 @@ class Status < ApplicationRecord
   after_save :process_bangtags, if: :local?
 
   class << self
-    include SearchHelper
-
     def search_for(term, account = nil, limit = 33, offset = 0)
       return none if account.nil?
       if term.start_with?('me:')
@@ -371,12 +369,13 @@ class Status < ApplicationRecord
         query = account.statuses
       else
         query = Status.where(account_id: account.id)
-          .or(Status.where(account_id: account.following, visibility: [:private, :local, :unlisted]))
+          .or(Status.where(visibility: [:local, :public]))
+          .or(Status.where(account_id: account.following, visibility: [:private, :unlisted]))
           .or(Status.where(id: account.mentions.select(:status_id)))
       end
-      return none if term.blank? || term.length < 3
+      return none if term.blank?
       query = query.without_reblogs
-        .regex(expand_search_query(term))
+        .search(term.unaccent)
         .offset(offset).limit(limit)
       apply_timeline_filters(query, account, true)
     rescue ActiveRecord::StatementInvalid
@@ -583,9 +582,9 @@ class Status < ApplicationRecord
       query = query.mention_not_excluded_by_account(account)
       unless account.custom_filters.nil?
         if account.user.invert_filters
-          query = query.regex_filtered_by_account(account.id)
+          query = query.search_filtered_by_account(account.id)
         else
-          query = query.regex_not_filtered_by_account(account.id)
+          query = query.search_not_filtered_by_account(account.id)
         end
       end
       query = query.not_missing_media_desc if account.filter_undescribed?
diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml
index 9c34a1071..eefa3530d 100644
--- a/config/locales/simple_form.en.yml
+++ b/config/locales/simple_form.en.yml
@@ -45,7 +45,7 @@ en:
         setting_skin: Reskins the selected Mastodon flavour
         setting_theme: Affects how Mastodon looks when you're logged in from any device.
         username: Your username will be unique on %{domain}
-        phrase_html: "<code>&quot;thing&quot;</code> - match whole words<br/><code>tags: &quot;tag1&quot; tag2 ...</code> - match tags (don't include <code>#</code>)<br/><code>subj: thing</code> - match subject or CW</code><br/><code>text: thing</code> - match text<br/><code>desc: thing</code> - match media descriptions"
+        phrase_html: "<strong>Examples</strong><br>Containing any terms: <code>this OR that</code><br>Containing all terms: <code>this that</code>, <code>this AND that</code><br>Containing an exact term: <code>&quot;this thing&quot;</code><br>Grouping: <code>this OR (&quot;this thing&quot; AND &quot;that thing&quot;)</code>"
       featured_tag:
         name: 'You might want to use one of these:'
       imports:
@@ -113,7 +113,7 @@ en:
         note: Bio
         otp_attempt: Two-factor code
         password: Password
-        phrase: Regular expression
+        phrase: Filter query
         setting_advanced_layout: Enable advanced web interface
         setting_aggregate_reblogs: Group repeats in timelines
         setting_auto_play_gif: Auto-play animated GIFs
diff --git a/db/migrate/20191211235208_create_normalized_statuses.rb b/db/migrate/20191211235208_create_normalized_statuses.rb
deleted file mode 100644
index 19c7cd6c3..000000000
--- a/db/migrate/20191211235208_create_normalized_statuses.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-class CreateNormalizedStatuses < ActiveRecord::Migration[5.2]
-  def up
-    create_table :normalized_statuses do |t|
-      t.references :status, null: false, foreign_key: {on_delete: :cascade}, index: {unique: true}
-      t.text :text
-    end
-
-    safety_assured do
-      remove_index :statuses, name: 'index_statuses_on_normalized_text_trgm'
-      execute 'INSERT INTO normalized_statuses (status_id, text) SELECT id, normalized_text FROM statuses'
-      remove_column :statuses, :normalized_text
-    end
-  end
-
-  def down
-    safety_assured do
-      execute 'UPDATE statuses SET normalized_text = s.text FROM (SELECT status_id, text FROM normalized_statuses) AS s WHERE statuses.id = s.id'
-      remove_index :normalized_statuses, name: 'index_statuses_on_normalized_text_trgm'
-      drop_table :normalized_statuses
-      add_column :statuses, :normalized_text, :text, null: false, default: ''
-    end
-  end
-end
diff --git a/db/migrate/20200109191740_migrate_back_to_fts.rb b/db/migrate/20200109191740_migrate_back_to_fts.rb
new file mode 100644
index 000000000..dd98f7649
--- /dev/null
+++ b/db/migrate/20200109191740_migrate_back_to_fts.rb
@@ -0,0 +1,42 @@
+class MigrateBackToFts < ActiveRecord::Migration[5.2]
+  def up
+    if table_exists? :normalized_statuses
+      remove_index :normalized_statuses, name: 'index_statuses_on_normalized_text_trgm'
+      drop_table :normalized_statuses
+    end
+
+    safety_assured do
+      execute <<-SQL.squish
+        DROP FUNCTION IF EXISTS public.f_normalize;
+        DROP FUNCTION IF EXISTS public.f_unaccent;
+
+        CREATE OR REPLACE FUNCTION public.f_strip_mentions(text)
+          RETURNS text LANGUAGE sql IMMUTABLE PARALLEL SAFE STRICT AS
+          $func$
+            SELECT regexp_replace(
+              regexp_replace($1, '</?span>', '', 'g'),
+              '>@[^[:space:]]+<', '><', 'g'
+            )
+          $func$;
+
+        CREATE OR REPLACE AGGREGATE tsquery_union(tsquery) (
+          SFUNC = tsquery_or,
+          STYPE = tsquery,
+          PARALLEL = SAFE
+        );
+
+        CREATE TEXT SEARCH CONFIGURATION fedi ( COPY = simple );
+
+        ALTER TEXT SEARCH CONFIGURATION fedi
+          ALTER MAPPING FOR hword, hword_part, word
+            WITH unaccent, simple;
+
+        ALTER TABLE statuses
+          ADD COLUMN tsv tsvector
+          GENERATED ALWAYS AS (
+            to_tsvector('fedi', f_strip_mentions(spoiler_text || ' ' || text))
+          ) STORED;
+      SQL
+    end
+  end
+end
diff --git a/db/migrate/20200110072034_add_index_to_tsv.rb b/db/migrate/20200110072034_add_index_to_tsv.rb
new file mode 100644
index 000000000..d6b66c2d6
--- /dev/null
+++ b/db/migrate/20200110072034_add_index_to_tsv.rb
@@ -0,0 +1,15 @@
+class AddIndexToTsv < ActiveRecord::Migration[5.2]
+  disable_ddl_transaction!
+
+  def up
+    safety_assured do
+      execute 'CREATE INDEX CONCURRENTLY statuses_text_vector_idx ON statuses USING GIN(tsv)'
+    end
+  end
+
+  def down
+    safety_assured do
+      execute 'DROP INDEX statuses_text_vector_idx ON statuses'
+    end
+  end
+end
diff --git a/db/structure.sql b/db/structure.sql
new file mode 100644
index 000000000..3ac813d4c
--- /dev/null
+++ b/db/structure.sql
@@ -0,0 +1,5382 @@
+SET statement_timeout = 0;
+SET lock_timeout = 0;
+SET idle_in_transaction_session_timeout = 0;
+SET client_encoding = 'UTF8';
+SET standard_conforming_strings = on;
+SELECT pg_catalog.set_config('search_path', '', false);
+SET check_function_bodies = false;
+SET xmloption = content;
+SET client_min_messages = warning;
+SET row_security = off;
+
+--
+-- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: -
+--
+
+CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public;
+
+
+--
+-- Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner: -
+--
+
+COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams';
+
+
+--
+-- Name: unaccent; Type: EXTENSION; Schema: -; Owner: -
+--
+
+CREATE EXTENSION IF NOT EXISTS unaccent WITH SCHEMA public;
+
+
+--
+-- Name: EXTENSION unaccent; Type: COMMENT; Schema: -; Owner: -
+--
+
+COMMENT ON EXTENSION unaccent IS 'text search dictionary that removes accents';
+
+
+--
+-- Name: f_lower_unaccent(text); Type: FUNCTION; Schema: public; Owner: -
+--
+
+CREATE FUNCTION public.f_lower_unaccent(text) RETURNS text
+    LANGUAGE sql IMMUTABLE STRICT PARALLEL SAFE
+    AS $_$
+SELECT lower(public.immutable_unaccent(regdictionary 'public.unaccent', $1))
+$_$;
+
+
+--
+-- Name: f_strip_mentions(text); Type: FUNCTION; Schema: public; Owner: -
+--
+
+CREATE FUNCTION public.f_strip_mentions(text) RETURNS text
+    LANGUAGE sql IMMUTABLE STRICT PARALLEL SAFE
+    AS $_$ SELECT regexp_replace( regexp_replace($1, '</?span>', '', 'g'), '>@[^[:space:]]+<', '><', 'g' ) $_$;
+
+
+--
+-- Name: immutable_unaccent(regdictionary, text); Type: FUNCTION; Schema: public; Owner: -
+--
+
+CREATE FUNCTION public.immutable_unaccent(regdictionary, text) RETURNS text
+    LANGUAGE c IMMUTABLE STRICT PARALLEL SAFE
+    AS '$libdir/unaccent', 'unaccent_dict';
+
+
+--
+-- Name: timestamp_id(text); Type: FUNCTION; Schema: public; Owner: -
+--
+
+CREATE FUNCTION public.timestamp_id(table_name text) RETURNS bigint
+    LANGUAGE plpgsql
+    AS $$
+  DECLARE
+    time_part bigint;
+    sequence_base bigint;
+    tail bigint;
+  BEGIN
+    time_part := (
+      -- Get the time in milliseconds
+      ((date_part('epoch', now()) * 1000))::bigint
+      -- And shift it over two bytes
+      << 16);
+
+    sequence_base := (
+      'x' ||
+      -- Take the first two bytes (four hex characters)
+      substr(
+        -- Of the MD5 hash of the data we documented
+        md5(table_name ||
+          '35e5aca1acf125e29cbea6f4107c3e5d' ||
+          time_part::text
+        ),
+        1, 4
+      )
+    -- And turn it into a bigint
+    )::bit(16)::bigint;
+
+    -- Finally, add our sequence number to our base, and chop
+    -- it to the last two bytes
+    tail := (
+      (sequence_base + nextval(table_name || '_id_seq'))
+      & 65535);
+
+    -- Return the time part and the sequence part. OR appears
+    -- faster here than addition, but they're equivalent:
+    -- time_part has no trailing two bytes, and tail is only
+    -- the last two bytes.
+    RETURN time_part | tail;
+  END
+$$;
+
+
+--
+-- Name: fedi; Type: TEXT SEARCH CONFIGURATION; Schema: public; Owner: -
+--
+
+CREATE TEXT SEARCH CONFIGURATION public.fedi (
+    PARSER = pg_catalog."default" );
+
+ALTER TEXT SEARCH CONFIGURATION public.fedi
+    ADD MAPPING FOR asciiword WITH simple;
+
+ALTER TEXT SEARCH CONFIGURATION public.fedi
+    ADD MAPPING FOR word WITH public.unaccent, simple;
+
+ALTER TEXT SEARCH CONFIGURATION public.fedi
+    ADD MAPPING FOR numword WITH simple;
+
+ALTER TEXT SEARCH CONFIGURATION public.fedi
+    ADD MAPPING FOR email WITH simple;
+
+ALTER TEXT SEARCH CONFIGURATION public.fedi
+    ADD MAPPING FOR url WITH simple;
+
+ALTER TEXT SEARCH CONFIGURATION public.fedi
+    ADD MAPPING FOR host WITH simple;
+
+ALTER TEXT SEARCH CONFIGURATION public.fedi
+    ADD MAPPING FOR sfloat WITH simple;
+
+ALTER TEXT SEARCH CONFIGURATION public.fedi
+    ADD MAPPING FOR version WITH simple;
+
+ALTER TEXT SEARCH CONFIGURATION public.fedi
+    ADD MAPPING FOR hword_numpart WITH simple;
+
+ALTER TEXT SEARCH CONFIGURATION public.fedi
+    ADD MAPPING FOR hword_part WITH public.unaccent, simple;
+
+ALTER TEXT SEARCH CONFIGURATION public.fedi
+    ADD MAPPING FOR hword_asciipart WITH simple;
+
+ALTER TEXT SEARCH CONFIGURATION public.fedi
+    ADD MAPPING FOR numhword WITH simple;
+
+ALTER TEXT SEARCH CONFIGURATION public.fedi
+    ADD MAPPING FOR asciihword WITH simple;
+
+ALTER TEXT SEARCH CONFIGURATION public.fedi
+    ADD MAPPING FOR hword WITH public.unaccent, simple;
+
+ALTER TEXT SEARCH CONFIGURATION public.fedi
+    ADD MAPPING FOR url_path WITH simple;
+
+ALTER TEXT SEARCH CONFIGURATION public.fedi
+    ADD MAPPING FOR file WITH simple;
+
+ALTER TEXT SEARCH CONFIGURATION public.fedi
+    ADD MAPPING FOR "float" WITH simple;
+
+ALTER TEXT SEARCH CONFIGURATION public.fedi
+    ADD MAPPING FOR "int" WITH simple;
+
+ALTER TEXT SEARCH CONFIGURATION public.fedi
+    ADD MAPPING FOR uint WITH simple;
+
+
+SET default_tablespace = '';
+
+SET default_table_access_method = heap;
+
+--
+-- Name: account_conversations; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.account_conversations (
+    id bigint NOT NULL,
+    account_id bigint,
+    conversation_id bigint,
+    participant_account_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
+    status_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
+    last_status_id bigint,
+    lock_version integer DEFAULT 0 NOT NULL,
+    unread boolean DEFAULT false NOT NULL
+);
+
+
+--
+-- Name: account_conversations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.account_conversations_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: account_conversations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.account_conversations_id_seq OWNED BY public.account_conversations.id;
+
+
+--
+-- Name: account_domain_blocks; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.account_domain_blocks (
+    id bigint NOT NULL,
+    domain character varying,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    account_id bigint
+);
+
+
+--
+-- Name: account_domain_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.account_domain_blocks_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: account_domain_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.account_domain_blocks_id_seq OWNED BY public.account_domain_blocks.id;
+
+
+--
+-- Name: account_identity_proofs; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.account_identity_proofs (
+    id bigint NOT NULL,
+    account_id bigint,
+    provider character varying DEFAULT ''::character varying NOT NULL,
+    provider_username character varying DEFAULT ''::character varying NOT NULL,
+    token text DEFAULT ''::text NOT NULL,
+    verified boolean DEFAULT false NOT NULL,
+    live boolean DEFAULT false NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: account_identity_proofs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.account_identity_proofs_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: account_identity_proofs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.account_identity_proofs_id_seq OWNED BY public.account_identity_proofs.id;
+
+
+--
+-- Name: account_moderation_notes; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.account_moderation_notes (
+    id bigint NOT NULL,
+    content text NOT NULL,
+    account_id bigint NOT NULL,
+    target_account_id bigint NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: account_moderation_notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.account_moderation_notes_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: account_moderation_notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.account_moderation_notes_id_seq OWNED BY public.account_moderation_notes.id;
+
+
+--
+-- Name: account_pins; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.account_pins (
+    id bigint NOT NULL,
+    account_id bigint,
+    target_account_id bigint,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: account_pins_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.account_pins_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: account_pins_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.account_pins_id_seq OWNED BY public.account_pins.id;
+
+
+--
+-- Name: account_stats; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.account_stats (
+    id bigint NOT NULL,
+    account_id bigint NOT NULL,
+    statuses_count bigint DEFAULT 0 NOT NULL,
+    following_count bigint DEFAULT 0 NOT NULL,
+    followers_count bigint DEFAULT 0 NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    last_status_at timestamp without time zone
+);
+
+
+--
+-- Name: account_stats_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.account_stats_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: account_stats_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.account_stats_id_seq OWNED BY public.account_stats.id;
+
+
+--
+-- Name: account_tag_stats; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.account_tag_stats (
+    id bigint NOT NULL,
+    tag_id bigint NOT NULL,
+    accounts_count bigint DEFAULT 0 NOT NULL,
+    hidden boolean DEFAULT false NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: account_tag_stats_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.account_tag_stats_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: account_tag_stats_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.account_tag_stats_id_seq OWNED BY public.account_tag_stats.id;
+
+
+--
+-- Name: account_warning_presets; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.account_warning_presets (
+    id bigint NOT NULL,
+    text text DEFAULT ''::text NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: account_warning_presets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.account_warning_presets_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: account_warning_presets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.account_warning_presets_id_seq OWNED BY public.account_warning_presets.id;
+
+
+--
+-- Name: account_warnings; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.account_warnings (
+    id bigint NOT NULL,
+    account_id bigint,
+    target_account_id bigint,
+    action integer DEFAULT 0 NOT NULL,
+    text text DEFAULT ''::text NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: account_warnings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.account_warnings_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: account_warnings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.account_warnings_id_seq OWNED BY public.account_warnings.id;
+
+
+--
+-- Name: accounts; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.accounts (
+    id bigint NOT NULL,
+    username character varying DEFAULT ''::character varying NOT NULL,
+    domain character varying,
+    secret character varying DEFAULT ''::character varying NOT NULL,
+    private_key text,
+    public_key text DEFAULT ''::text NOT NULL,
+    remote_url character varying DEFAULT ''::character varying NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    note text DEFAULT ''::text NOT NULL,
+    display_name character varying DEFAULT ''::character varying NOT NULL,
+    uri character varying DEFAULT ''::character varying NOT NULL,
+    url character varying,
+    avatar_file_name character varying,
+    avatar_content_type character varying,
+    avatar_file_size integer,
+    avatar_updated_at timestamp without time zone,
+    header_file_name character varying,
+    header_content_type character varying,
+    header_file_size integer,
+    header_updated_at timestamp without time zone,
+    avatar_remote_url character varying,
+    locked boolean DEFAULT false NOT NULL,
+    header_remote_url character varying DEFAULT ''::character varying NOT NULL,
+    last_webfingered_at timestamp without time zone,
+    inbox_url character varying DEFAULT ''::character varying NOT NULL,
+    outbox_url character varying DEFAULT ''::character varying NOT NULL,
+    shared_inbox_url character varying DEFAULT ''::character varying NOT NULL,
+    followers_url character varying DEFAULT ''::character varying NOT NULL,
+    memorial boolean DEFAULT false NOT NULL,
+    moved_to_account_id bigint,
+    featured_collection_url character varying,
+    fields jsonb,
+    actor_type character varying,
+    discoverable boolean,
+    also_known_as character varying[],
+    hidden boolean DEFAULT false NOT NULL,
+    vars jsonb DEFAULT '{}'::jsonb NOT NULL,
+    replies boolean DEFAULT true NOT NULL,
+    unlisted boolean DEFAULT false NOT NULL,
+    force_unlisted boolean DEFAULT false NOT NULL,
+    force_sensitive boolean DEFAULT false NOT NULL,
+    adult_content boolean DEFAULT false NOT NULL,
+    silenced_at timestamp without time zone,
+    suspended_at timestamp without time zone,
+    gently boolean DEFAULT false NOT NULL,
+    kobold boolean DEFAULT false NOT NULL,
+    froze boolean,
+    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
+);
+
+
+--
+-- Name: accounts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.accounts_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: accounts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.accounts_id_seq OWNED BY public.accounts.id;
+
+
+--
+-- Name: accounts_tags; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.accounts_tags (
+    account_id bigint NOT NULL,
+    tag_id bigint NOT NULL
+);
+
+
+--
+-- Name: admin_action_logs; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.admin_action_logs (
+    id bigint NOT NULL,
+    account_id bigint,
+    action character varying DEFAULT ''::character varying NOT NULL,
+    target_type character varying,
+    target_id bigint,
+    recorded_changes text DEFAULT ''::text NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: admin_action_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.admin_action_logs_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: admin_action_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.admin_action_logs_id_seq OWNED BY public.admin_action_logs.id;
+
+
+--
+-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.ar_internal_metadata (
+    key character varying NOT NULL,
+    value character varying,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: backups; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.backups (
+    id bigint NOT NULL,
+    user_id bigint,
+    dump_file_name character varying,
+    dump_content_type character varying,
+    dump_file_size integer,
+    dump_updated_at timestamp without time zone,
+    processed boolean DEFAULT false NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: backups_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.backups_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: backups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.backups_id_seq OWNED BY public.backups.id;
+
+
+--
+-- Name: blocks; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.blocks (
+    id bigint NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    account_id bigint NOT NULL,
+    target_account_id bigint NOT NULL,
+    uri character varying
+);
+
+
+--
+-- Name: blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.blocks_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.blocks_id_seq OWNED BY public.blocks.id;
+
+
+--
+-- Name: bookmarks; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.bookmarks (
+    id bigint NOT NULL,
+    account_id bigint NOT NULL,
+    status_id bigint NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: bookmarks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.bookmarks_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: bookmarks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.bookmarks_id_seq OWNED BY public.bookmarks.id;
+
+
+--
+-- Name: conversation_kicks; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.conversation_kicks (
+    id bigint NOT NULL,
+    account_id bigint NOT NULL,
+    conversation_id bigint NOT NULL
+);
+
+
+--
+-- Name: conversation_kicks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.conversation_kicks_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: conversation_kicks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.conversation_kicks_id_seq OWNED BY public.conversation_kicks.id;
+
+
+--
+-- Name: conversation_mutes; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.conversation_mutes (
+    id bigint NOT NULL,
+    conversation_id bigint NOT NULL,
+    account_id bigint NOT NULL
+);
+
+
+--
+-- Name: conversation_mutes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.conversation_mutes_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: conversation_mutes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.conversation_mutes_id_seq OWNED BY public.conversation_mutes.id;
+
+
+--
+-- Name: conversations; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.conversations (
+    id bigint NOT NULL,
+    uri character varying,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: conversations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.conversations_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: conversations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.conversations_id_seq OWNED BY public.conversations.id;
+
+
+--
+-- Name: custom_emojis; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.custom_emojis (
+    id bigint NOT NULL,
+    shortcode character varying DEFAULT ''::character varying NOT NULL,
+    domain character varying,
+    image_file_name character varying,
+    image_content_type character varying,
+    image_file_size integer,
+    image_updated_at timestamp without time zone,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    disabled boolean DEFAULT false NOT NULL,
+    uri character varying,
+    image_remote_url character varying,
+    visible_in_picker boolean DEFAULT true NOT NULL
+);
+
+
+--
+-- Name: custom_emojis_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.custom_emojis_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: custom_emojis_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.custom_emojis_id_seq OWNED BY public.custom_emojis.id;
+
+
+--
+-- Name: custom_filters; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.custom_filters (
+    id bigint NOT NULL,
+    account_id bigint,
+    expires_at timestamp without time zone,
+    phrase text DEFAULT ''::text NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: custom_filters_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.custom_filters_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: custom_filters_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.custom_filters_id_seq OWNED BY public.custom_filters.id;
+
+
+--
+-- Name: destructing_statuses; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.destructing_statuses (
+    id bigint NOT NULL,
+    status_id bigint,
+    delete_after timestamp without time zone
+);
+
+
+--
+-- Name: destructing_statuses_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.destructing_statuses_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: destructing_statuses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.destructing_statuses_id_seq OWNED BY public.destructing_statuses.id;
+
+
+--
+-- Name: domain_blocks; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.domain_blocks (
+    id bigint NOT NULL,
+    domain character varying DEFAULT ''::character varying NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    severity integer DEFAULT 0,
+    reject_media boolean DEFAULT false NOT NULL,
+    reject_reports boolean DEFAULT false NOT NULL,
+    force_sensitive boolean DEFAULT false NOT NULL,
+    reason text,
+    reject_unknown boolean DEFAULT false NOT NULL,
+    processing boolean DEFAULT true NOT NULL
+);
+
+
+--
+-- Name: domain_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.domain_blocks_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: domain_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.domain_blocks_id_seq OWNED BY public.domain_blocks.id;
+
+
+--
+-- Name: email_domain_blocks; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.email_domain_blocks (
+    id bigint NOT NULL,
+    domain character varying DEFAULT ''::character varying NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: email_domain_blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.email_domain_blocks_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: email_domain_blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.email_domain_blocks_id_seq OWNED BY public.email_domain_blocks.id;
+
+
+--
+-- Name: favourites; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.favourites (
+    id bigint NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    account_id bigint NOT NULL,
+    status_id bigint NOT NULL
+);
+
+
+--
+-- Name: favourites_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.favourites_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: favourites_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.favourites_id_seq OWNED BY public.favourites.id;
+
+
+--
+-- Name: featured_tags; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.featured_tags (
+    id bigint NOT NULL,
+    account_id bigint,
+    tag_id bigint,
+    statuses_count bigint DEFAULT 0 NOT NULL,
+    last_status_at timestamp without time zone,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: featured_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.featured_tags_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: featured_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.featured_tags_id_seq OWNED BY public.featured_tags.id;
+
+
+--
+-- Name: follow_requests; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.follow_requests (
+    id bigint NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    account_id bigint NOT NULL,
+    target_account_id bigint NOT NULL,
+    show_reblogs boolean DEFAULT true NOT NULL,
+    uri character varying
+);
+
+
+--
+-- Name: follow_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.follow_requests_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: follow_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.follow_requests_id_seq OWNED BY public.follow_requests.id;
+
+
+--
+-- Name: follows; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.follows (
+    id bigint NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    account_id bigint NOT NULL,
+    target_account_id bigint NOT NULL,
+    show_reblogs boolean DEFAULT true NOT NULL,
+    uri character varying
+);
+
+
+--
+-- Name: follows_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.follows_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: follows_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.follows_id_seq OWNED BY public.follows.id;
+
+
+--
+-- Name: identities; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.identities (
+    id bigint NOT NULL,
+    provider character varying DEFAULT ''::character varying NOT NULL,
+    uid character varying DEFAULT ''::character varying NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    user_id bigint
+);
+
+
+--
+-- Name: identities_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.identities_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: identities_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.identities_id_seq OWNED BY public.identities.id;
+
+
+--
+-- Name: imported_statuses; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.imported_statuses (
+    id bigint NOT NULL,
+    status_id bigint,
+    origin character varying
+);
+
+
+--
+-- Name: imported_statuses_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.imported_statuses_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: imported_statuses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.imported_statuses_id_seq OWNED BY public.imported_statuses.id;
+
+
+--
+-- Name: imports; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.imports (
+    id bigint NOT NULL,
+    type integer NOT NULL,
+    approved boolean DEFAULT false NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    data_file_name character varying,
+    data_content_type character varying,
+    data_file_size integer,
+    data_updated_at timestamp without time zone,
+    account_id bigint NOT NULL,
+    overwrite boolean DEFAULT false NOT NULL
+);
+
+
+--
+-- Name: imports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.imports_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: imports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.imports_id_seq OWNED BY public.imports.id;
+
+
+--
+-- Name: invites; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.invites (
+    id bigint NOT NULL,
+    user_id bigint NOT NULL,
+    code character varying DEFAULT ''::character varying NOT NULL,
+    expires_at timestamp without time zone,
+    max_uses integer,
+    uses integer DEFAULT 0 NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    autofollow boolean DEFAULT false NOT NULL
+);
+
+
+--
+-- Name: invites_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.invites_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: invites_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.invites_id_seq OWNED BY public.invites.id;
+
+
+--
+-- Name: linked_users; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.linked_users (
+    id bigint NOT NULL,
+    user_id bigint,
+    target_user_id bigint,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: linked_users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.linked_users_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: linked_users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.linked_users_id_seq OWNED BY public.linked_users.id;
+
+
+--
+-- Name: list_accounts; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.list_accounts (
+    id bigint NOT NULL,
+    list_id bigint NOT NULL,
+    account_id bigint NOT NULL,
+    follow_id bigint NOT NULL
+);
+
+
+--
+-- Name: list_accounts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.list_accounts_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: list_accounts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.list_accounts_id_seq OWNED BY public.list_accounts.id;
+
+
+--
+-- Name: lists; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.lists (
+    id bigint NOT NULL,
+    account_id bigint NOT NULL,
+    title character varying DEFAULT ''::character varying NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    replies_policy integer DEFAULT 0 NOT NULL,
+    show_self boolean DEFAULT false NOT NULL
+);
+
+
+--
+-- Name: lists_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.lists_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: lists_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.lists_id_seq OWNED BY public.lists.id;
+
+
+--
+-- Name: media_attachments; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.media_attachments (
+    id bigint NOT NULL,
+    status_id bigint,
+    file_file_name character varying,
+    file_content_type character varying,
+    file_file_size integer,
+    file_updated_at timestamp without time zone,
+    remote_url character varying DEFAULT ''::character varying NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    shortcode character varying,
+    type integer DEFAULT 0 NOT NULL,
+    file_meta json,
+    account_id bigint,
+    description text,
+    scheduled_status_id bigint,
+    blurhash character varying
+);
+
+
+--
+-- Name: media_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.media_attachments_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: media_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.media_attachments_id_seq OWNED BY public.media_attachments.id;
+
+
+--
+-- Name: mentions; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.mentions (
+    id bigint NOT NULL,
+    status_id bigint,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    account_id bigint,
+    silent boolean DEFAULT false NOT NULL
+);
+
+
+--
+-- Name: mentions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.mentions_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: mentions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.mentions_id_seq OWNED BY public.mentions.id;
+
+
+--
+-- Name: mutes; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.mutes (
+    id bigint NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    hide_notifications boolean DEFAULT true NOT NULL,
+    account_id bigint NOT NULL,
+    target_account_id bigint NOT NULL,
+    timelines_only boolean DEFAULT false NOT NULL
+);
+
+
+--
+-- Name: mutes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.mutes_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: mutes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.mutes_id_seq OWNED BY public.mutes.id;
+
+
+--
+-- Name: notifications; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.notifications (
+    id bigint NOT NULL,
+    activity_id bigint NOT NULL,
+    activity_type character varying NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    account_id bigint NOT NULL,
+    from_account_id bigint NOT NULL
+);
+
+
+--
+-- Name: notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.notifications_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.notifications_id_seq OWNED BY public.notifications.id;
+
+
+--
+-- Name: oauth_access_grants; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.oauth_access_grants (
+    id bigint NOT NULL,
+    token character varying NOT NULL,
+    expires_in integer NOT NULL,
+    redirect_uri text NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    revoked_at timestamp without time zone,
+    scopes character varying,
+    application_id bigint NOT NULL,
+    resource_owner_id bigint NOT NULL
+);
+
+
+--
+-- Name: oauth_access_grants_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.oauth_access_grants_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: oauth_access_grants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.oauth_access_grants_id_seq OWNED BY public.oauth_access_grants.id;
+
+
+--
+-- Name: oauth_access_tokens; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.oauth_access_tokens (
+    id bigint NOT NULL,
+    token character varying NOT NULL,
+    refresh_token character varying,
+    expires_in integer,
+    revoked_at timestamp without time zone,
+    created_at timestamp without time zone NOT NULL,
+    scopes character varying,
+    application_id bigint,
+    resource_owner_id bigint
+);
+
+
+--
+-- Name: oauth_access_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.oauth_access_tokens_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: oauth_access_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.oauth_access_tokens_id_seq OWNED BY public.oauth_access_tokens.id;
+
+
+--
+-- Name: oauth_applications; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.oauth_applications (
+    id bigint NOT NULL,
+    name character varying NOT NULL,
+    uid character varying NOT NULL,
+    secret character varying NOT NULL,
+    redirect_uri text NOT NULL,
+    scopes character varying DEFAULT ''::character varying NOT NULL,
+    created_at timestamp without time zone,
+    updated_at timestamp without time zone,
+    superapp boolean DEFAULT false NOT NULL,
+    website character varying,
+    owner_type character varying,
+    owner_id bigint,
+    confidential boolean DEFAULT true NOT NULL
+);
+
+
+--
+-- Name: oauth_applications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.oauth_applications_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: oauth_applications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.oauth_applications_id_seq OWNED BY public.oauth_applications.id;
+
+
+--
+-- Name: pghero_space_stats; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.pghero_space_stats (
+    id bigint NOT NULL,
+    database text,
+    schema text,
+    relation text,
+    size bigint,
+    captured_at timestamp without time zone
+);
+
+
+--
+-- Name: pghero_space_stats_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.pghero_space_stats_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: pghero_space_stats_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.pghero_space_stats_id_seq OWNED BY public.pghero_space_stats.id;
+
+
+--
+-- Name: poll_votes; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.poll_votes (
+    id bigint NOT NULL,
+    account_id bigint,
+    poll_id bigint,
+    choice integer DEFAULT 0 NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    uri character varying
+);
+
+
+--
+-- Name: poll_votes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.poll_votes_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: poll_votes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.poll_votes_id_seq OWNED BY public.poll_votes.id;
+
+
+--
+-- Name: polls; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.polls (
+    id bigint NOT NULL,
+    account_id bigint,
+    status_id bigint,
+    expires_at timestamp without time zone,
+    options character varying[] DEFAULT '{}'::character varying[] NOT NULL,
+    cached_tallies bigint[] DEFAULT '{}'::bigint[] NOT NULL,
+    multiple boolean DEFAULT false NOT NULL,
+    hide_totals boolean DEFAULT false NOT NULL,
+    votes_count bigint DEFAULT 0 NOT NULL,
+    last_fetched_at timestamp without time zone,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    lock_version integer DEFAULT 0 NOT NULL
+);
+
+
+--
+-- Name: polls_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.polls_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: polls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.polls_id_seq OWNED BY public.polls.id;
+
+
+--
+-- Name: preview_cards; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.preview_cards (
+    id bigint NOT NULL,
+    url character varying DEFAULT ''::character varying NOT NULL,
+    title character varying DEFAULT ''::character varying NOT NULL,
+    description character varying DEFAULT ''::character varying NOT NULL,
+    image_file_name character varying,
+    image_content_type character varying,
+    image_file_size integer,
+    image_updated_at timestamp without time zone,
+    type integer DEFAULT 0 NOT NULL,
+    html text DEFAULT ''::text NOT NULL,
+    author_name character varying DEFAULT ''::character varying NOT NULL,
+    author_url character varying DEFAULT ''::character varying NOT NULL,
+    provider_name character varying DEFAULT ''::character varying NOT NULL,
+    provider_url character varying DEFAULT ''::character varying NOT NULL,
+    width integer DEFAULT 0 NOT NULL,
+    height integer DEFAULT 0 NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    embed_url character varying DEFAULT ''::character varying NOT NULL
+);
+
+
+--
+-- Name: preview_cards_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.preview_cards_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: preview_cards_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.preview_cards_id_seq OWNED BY public.preview_cards.id;
+
+
+--
+-- Name: preview_cards_statuses; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.preview_cards_statuses (
+    preview_card_id bigint NOT NULL,
+    status_id bigint NOT NULL
+);
+
+
+--
+-- Name: queued_boosts; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.queued_boosts (
+    id bigint NOT NULL,
+    account_id bigint,
+    status_id bigint,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: queued_boosts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.queued_boosts_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: queued_boosts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.queued_boosts_id_seq OWNED BY public.queued_boosts.id;
+
+
+--
+-- Name: relays; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.relays (
+    id bigint NOT NULL,
+    inbox_url character varying DEFAULT ''::character varying NOT NULL,
+    follow_activity_id character varying,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    state integer DEFAULT 0 NOT NULL
+);
+
+
+--
+-- Name: relays_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.relays_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: relays_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.relays_id_seq OWNED BY public.relays.id;
+
+
+--
+-- Name: report_notes; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.report_notes (
+    id bigint NOT NULL,
+    content text NOT NULL,
+    report_id bigint NOT NULL,
+    account_id bigint NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: report_notes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.report_notes_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: report_notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.report_notes_id_seq OWNED BY public.report_notes.id;
+
+
+--
+-- Name: reports; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.reports (
+    id bigint NOT NULL,
+    status_ids bigint[] DEFAULT '{}'::bigint[] NOT NULL,
+    comment text DEFAULT ''::text NOT NULL,
+    action_taken boolean DEFAULT false NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    account_id bigint NOT NULL,
+    action_taken_by_account_id bigint,
+    target_account_id bigint NOT NULL,
+    assigned_account_id bigint,
+    uri character varying
+);
+
+
+--
+-- Name: reports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.reports_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: reports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.reports_id_seq OWNED BY public.reports.id;
+
+
+--
+-- Name: scheduled_statuses; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.scheduled_statuses (
+    id bigint NOT NULL,
+    account_id bigint,
+    scheduled_at timestamp without time zone,
+    params jsonb
+);
+
+
+--
+-- Name: scheduled_statuses_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.scheduled_statuses_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: scheduled_statuses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.scheduled_statuses_id_seq OWNED BY public.scheduled_statuses.id;
+
+
+--
+-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.schema_migrations (
+    version character varying NOT NULL
+);
+
+
+--
+-- Name: session_activations; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.session_activations (
+    id bigint NOT NULL,
+    session_id character varying NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    user_agent character varying DEFAULT ''::character varying NOT NULL,
+    ip inet,
+    access_token_id bigint,
+    user_id bigint NOT NULL,
+    web_push_subscription_id bigint
+);
+
+
+--
+-- Name: session_activations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.session_activations_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: session_activations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.session_activations_id_seq OWNED BY public.session_activations.id;
+
+
+--
+-- Name: settings; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.settings (
+    id bigint NOT NULL,
+    var character varying NOT NULL,
+    value text,
+    thing_type character varying,
+    created_at timestamp without time zone,
+    updated_at timestamp without time zone,
+    thing_id bigint
+);
+
+
+--
+-- Name: settings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.settings_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.settings_id_seq OWNED BY public.settings.id;
+
+
+--
+-- Name: sharekeys; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.sharekeys (
+    id bigint NOT NULL,
+    status_id bigint,
+    key character varying
+);
+
+
+--
+-- Name: sharekeys_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.sharekeys_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: sharekeys_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.sharekeys_id_seq OWNED BY public.sharekeys.id;
+
+
+--
+-- Name: site_uploads; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.site_uploads (
+    id bigint NOT NULL,
+    var character varying DEFAULT ''::character varying NOT NULL,
+    file_file_name character varying,
+    file_content_type character varying,
+    file_file_size integer,
+    file_updated_at timestamp without time zone,
+    meta json,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: site_uploads_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.site_uploads_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: site_uploads_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.site_uploads_id_seq OWNED BY public.site_uploads.id;
+
+
+--
+-- Name: status_pins; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.status_pins (
+    id bigint NOT NULL,
+    account_id bigint NOT NULL,
+    status_id bigint NOT NULL,
+    created_at timestamp without time zone DEFAULT now() NOT NULL,
+    updated_at timestamp without time zone DEFAULT now() NOT NULL
+);
+
+
+--
+-- Name: status_pins_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.status_pins_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: status_pins_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.status_pins_id_seq OWNED BY public.status_pins.id;
+
+
+--
+-- Name: status_stats; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.status_stats (
+    id bigint NOT NULL,
+    status_id bigint NOT NULL,
+    replies_count bigint DEFAULT 0 NOT NULL,
+    reblogs_count bigint DEFAULT 0 NOT NULL,
+    favourites_count bigint DEFAULT 0 NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: status_stats_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.status_stats_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: status_stats_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.status_stats_id_seq OWNED BY public.status_stats.id;
+
+
+--
+-- Name: statuses; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.statuses (
+    id bigint DEFAULT public.timestamp_id('statuses'::text) NOT NULL,
+    uri character varying,
+    text text DEFAULT ''::text NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    in_reply_to_id bigint,
+    reblog_of_id bigint,
+    url character varying,
+    sensitive boolean DEFAULT false NOT NULL,
+    visibility integer DEFAULT 0 NOT NULL,
+    spoiler_text text DEFAULT ''::text NOT NULL,
+    reply boolean DEFAULT false NOT NULL,
+    language character varying,
+    conversation_id bigint,
+    local boolean,
+    account_id bigint NOT NULL,
+    application_id bigint,
+    in_reply_to_account_id bigint,
+    local_only boolean,
+    poll_id bigint,
+    curated boolean DEFAULT false NOT NULL,
+    network boolean DEFAULT false NOT NULL,
+    content_type character varying,
+    footer text,
+    edited boolean,
+    boostable boolean,
+    reject_replies boolean,
+    tsv tsvector GENERATED ALWAYS AS (to_tsvector('public.fedi'::regconfig, public.f_strip_mentions(((spoiler_text || ' '::text) || text)))) STORED
+);
+
+
+--
+-- Name: statuses_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.statuses_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: statuses_tags; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.statuses_tags (
+    status_id bigint NOT NULL,
+    tag_id bigint NOT NULL
+);
+
+
+--
+-- Name: stream_entries; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.stream_entries (
+    id bigint NOT NULL,
+    activity_id bigint,
+    activity_type character varying,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    hidden boolean DEFAULT false NOT NULL,
+    account_id bigint
+);
+
+
+--
+-- Name: stream_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.stream_entries_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: stream_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.stream_entries_id_seq OWNED BY public.stream_entries.id;
+
+
+--
+-- Name: tags; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.tags (
+    id bigint NOT NULL,
+    name character varying DEFAULT ''::character varying NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    local boolean DEFAULT false NOT NULL,
+    private boolean DEFAULT false NOT NULL,
+    unlisted boolean DEFAULT false NOT NULL
+);
+
+
+--
+-- Name: tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.tags_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.tags_id_seq OWNED BY public.tags.id;
+
+
+--
+-- Name: tombstones; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.tombstones (
+    id bigint NOT NULL,
+    account_id bigint,
+    uri character varying NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    by_moderator boolean
+);
+
+
+--
+-- Name: tombstones_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.tombstones_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: tombstones_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.tombstones_id_seq OWNED BY public.tombstones.id;
+
+
+--
+-- Name: user_invite_requests; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.user_invite_requests (
+    id bigint NOT NULL,
+    user_id bigint,
+    text text,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: user_invite_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.user_invite_requests_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: user_invite_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.user_invite_requests_id_seq OWNED BY public.user_invite_requests.id;
+
+
+--
+-- Name: users; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.users (
+    id bigint NOT NULL,
+    email character varying DEFAULT ''::character varying NOT NULL,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    encrypted_password character varying DEFAULT ''::character varying NOT NULL,
+    reset_password_token character varying,
+    reset_password_sent_at timestamp without time zone,
+    remember_created_at timestamp without time zone,
+    sign_in_count integer DEFAULT 0 NOT NULL,
+    current_sign_in_at timestamp without time zone,
+    last_sign_in_at timestamp without time zone,
+    current_sign_in_ip inet,
+    last_sign_in_ip inet,
+    admin boolean DEFAULT false NOT NULL,
+    confirmation_token character varying,
+    confirmed_at timestamp without time zone,
+    confirmation_sent_at timestamp without time zone,
+    unconfirmed_email character varying,
+    locale character varying,
+    encrypted_otp_secret character varying,
+    encrypted_otp_secret_iv character varying,
+    encrypted_otp_secret_salt character varying,
+    consumed_timestep integer,
+    otp_required_for_login boolean DEFAULT false NOT NULL,
+    last_emailed_at timestamp without time zone,
+    otp_backup_codes character varying[],
+    filtered_languages character varying[] DEFAULT '{}'::character varying[] NOT NULL,
+    account_id bigint NOT NULL,
+    disabled boolean DEFAULT false NOT NULL,
+    moderator boolean DEFAULT false NOT NULL,
+    invite_id bigint,
+    remember_token character varying,
+    chosen_languages character varying[],
+    created_by_application_id bigint,
+    approved boolean DEFAULT true NOT NULL,
+    vars jsonb DEFAULT '{}'::jsonb NOT NULL,
+    hide_boosts boolean,
+    only_known boolean,
+    invert_filters boolean DEFAULT false NOT NULL,
+    filter_timelines_only boolean DEFAULT false NOT NULL
+);
+
+
+--
+-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.users_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
+
+
+--
+-- Name: web_push_subscriptions; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.web_push_subscriptions (
+    id bigint NOT NULL,
+    endpoint character varying NOT NULL,
+    key_p256dh character varying NOT NULL,
+    key_auth character varying NOT NULL,
+    data json,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    access_token_id bigint,
+    user_id bigint
+);
+
+
+--
+-- Name: web_push_subscriptions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.web_push_subscriptions_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: web_push_subscriptions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.web_push_subscriptions_id_seq OWNED BY public.web_push_subscriptions.id;
+
+
+--
+-- Name: web_settings; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.web_settings (
+    id bigint NOT NULL,
+    data json,
+    created_at timestamp without time zone NOT NULL,
+    updated_at timestamp without time zone NOT NULL,
+    user_id bigint NOT NULL
+);
+
+
+--
+-- Name: web_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.web_settings_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MINVALUE
+    NO MAXVALUE
+    CACHE 1;
+
+
+--
+-- Name: web_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.web_settings_id_seq OWNED BY public.web_settings.id;
+
+
+--
+-- Name: account_conversations id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_conversations ALTER COLUMN id SET DEFAULT nextval('public.account_conversations_id_seq'::regclass);
+
+
+--
+-- Name: account_domain_blocks id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_domain_blocks ALTER COLUMN id SET DEFAULT nextval('public.account_domain_blocks_id_seq'::regclass);
+
+
+--
+-- Name: account_identity_proofs id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_identity_proofs ALTER COLUMN id SET DEFAULT nextval('public.account_identity_proofs_id_seq'::regclass);
+
+
+--
+-- Name: account_moderation_notes id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_moderation_notes ALTER COLUMN id SET DEFAULT nextval('public.account_moderation_notes_id_seq'::regclass);
+
+
+--
+-- Name: account_pins id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_pins ALTER COLUMN id SET DEFAULT nextval('public.account_pins_id_seq'::regclass);
+
+
+--
+-- Name: account_stats id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_stats ALTER COLUMN id SET DEFAULT nextval('public.account_stats_id_seq'::regclass);
+
+
+--
+-- Name: account_tag_stats id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_tag_stats ALTER COLUMN id SET DEFAULT nextval('public.account_tag_stats_id_seq'::regclass);
+
+
+--
+-- Name: account_warning_presets id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_warning_presets ALTER COLUMN id SET DEFAULT nextval('public.account_warning_presets_id_seq'::regclass);
+
+
+--
+-- Name: account_warnings id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_warnings ALTER COLUMN id SET DEFAULT nextval('public.account_warnings_id_seq'::regclass);
+
+
+--
+-- Name: accounts id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.accounts ALTER COLUMN id SET DEFAULT nextval('public.accounts_id_seq'::regclass);
+
+
+--
+-- Name: admin_action_logs id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.admin_action_logs ALTER COLUMN id SET DEFAULT nextval('public.admin_action_logs_id_seq'::regclass);
+
+
+--
+-- Name: backups id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.backups ALTER COLUMN id SET DEFAULT nextval('public.backups_id_seq'::regclass);
+
+
+--
+-- Name: blocks id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.blocks ALTER COLUMN id SET DEFAULT nextval('public.blocks_id_seq'::regclass);
+
+
+--
+-- Name: bookmarks id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.bookmarks ALTER COLUMN id SET DEFAULT nextval('public.bookmarks_id_seq'::regclass);
+
+
+--
+-- Name: conversation_kicks id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.conversation_kicks ALTER COLUMN id SET DEFAULT nextval('public.conversation_kicks_id_seq'::regclass);
+
+
+--
+-- Name: conversation_mutes id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.conversation_mutes ALTER COLUMN id SET DEFAULT nextval('public.conversation_mutes_id_seq'::regclass);
+
+
+--
+-- Name: conversations id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.conversations ALTER COLUMN id SET DEFAULT nextval('public.conversations_id_seq'::regclass);
+
+
+--
+-- Name: custom_emojis id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.custom_emojis ALTER COLUMN id SET DEFAULT nextval('public.custom_emojis_id_seq'::regclass);
+
+
+--
+-- Name: custom_filters id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.custom_filters ALTER COLUMN id SET DEFAULT nextval('public.custom_filters_id_seq'::regclass);
+
+
+--
+-- Name: destructing_statuses id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.destructing_statuses ALTER COLUMN id SET DEFAULT nextval('public.destructing_statuses_id_seq'::regclass);
+
+
+--
+-- Name: domain_blocks id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.domain_blocks ALTER COLUMN id SET DEFAULT nextval('public.domain_blocks_id_seq'::regclass);
+
+
+--
+-- Name: email_domain_blocks id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.email_domain_blocks ALTER COLUMN id SET DEFAULT nextval('public.email_domain_blocks_id_seq'::regclass);
+
+
+--
+-- Name: favourites id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.favourites ALTER COLUMN id SET DEFAULT nextval('public.favourites_id_seq'::regclass);
+
+
+--
+-- Name: featured_tags id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.featured_tags ALTER COLUMN id SET DEFAULT nextval('public.featured_tags_id_seq'::regclass);
+
+
+--
+-- Name: follow_requests id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.follow_requests ALTER COLUMN id SET DEFAULT nextval('public.follow_requests_id_seq'::regclass);
+
+
+--
+-- Name: follows id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.follows ALTER COLUMN id SET DEFAULT nextval('public.follows_id_seq'::regclass);
+
+
+--
+-- Name: identities id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.identities ALTER COLUMN id SET DEFAULT nextval('public.identities_id_seq'::regclass);
+
+
+--
+-- Name: imported_statuses id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.imported_statuses ALTER COLUMN id SET DEFAULT nextval('public.imported_statuses_id_seq'::regclass);
+
+
+--
+-- Name: imports id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.imports ALTER COLUMN id SET DEFAULT nextval('public.imports_id_seq'::regclass);
+
+
+--
+-- Name: invites id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.invites ALTER COLUMN id SET DEFAULT nextval('public.invites_id_seq'::regclass);
+
+
+--
+-- Name: linked_users id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.linked_users ALTER COLUMN id SET DEFAULT nextval('public.linked_users_id_seq'::regclass);
+
+
+--
+-- Name: list_accounts id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.list_accounts ALTER COLUMN id SET DEFAULT nextval('public.list_accounts_id_seq'::regclass);
+
+
+--
+-- Name: lists id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.lists ALTER COLUMN id SET DEFAULT nextval('public.lists_id_seq'::regclass);
+
+
+--
+-- Name: media_attachments id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.media_attachments ALTER COLUMN id SET DEFAULT nextval('public.media_attachments_id_seq'::regclass);
+
+
+--
+-- Name: mentions id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.mentions ALTER COLUMN id SET DEFAULT nextval('public.mentions_id_seq'::regclass);
+
+
+--
+-- Name: mutes id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.mutes ALTER COLUMN id SET DEFAULT nextval('public.mutes_id_seq'::regclass);
+
+
+--
+-- Name: notifications id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.notifications ALTER COLUMN id SET DEFAULT nextval('public.notifications_id_seq'::regclass);
+
+
+--
+-- Name: oauth_access_grants id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.oauth_access_grants ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_grants_id_seq'::regclass);
+
+
+--
+-- Name: oauth_access_tokens id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.oauth_access_tokens_id_seq'::regclass);
+
+
+--
+-- Name: oauth_applications id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.oauth_applications ALTER COLUMN id SET DEFAULT nextval('public.oauth_applications_id_seq'::regclass);
+
+
+--
+-- Name: pghero_space_stats id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.pghero_space_stats ALTER COLUMN id SET DEFAULT nextval('public.pghero_space_stats_id_seq'::regclass);
+
+
+--
+-- Name: poll_votes id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.poll_votes ALTER COLUMN id SET DEFAULT nextval('public.poll_votes_id_seq'::regclass);
+
+
+--
+-- Name: polls id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.polls ALTER COLUMN id SET DEFAULT nextval('public.polls_id_seq'::regclass);
+
+
+--
+-- Name: preview_cards id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.preview_cards ALTER COLUMN id SET DEFAULT nextval('public.preview_cards_id_seq'::regclass);
+
+
+--
+-- Name: queued_boosts id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.queued_boosts ALTER COLUMN id SET DEFAULT nextval('public.queued_boosts_id_seq'::regclass);
+
+
+--
+-- Name: relays id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.relays ALTER COLUMN id SET DEFAULT nextval('public.relays_id_seq'::regclass);
+
+
+--
+-- Name: report_notes id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.report_notes ALTER COLUMN id SET DEFAULT nextval('public.report_notes_id_seq'::regclass);
+
+
+--
+-- Name: reports id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.reports ALTER COLUMN id SET DEFAULT nextval('public.reports_id_seq'::regclass);
+
+
+--
+-- Name: scheduled_statuses id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.scheduled_statuses ALTER COLUMN id SET DEFAULT nextval('public.scheduled_statuses_id_seq'::regclass);
+
+
+--
+-- Name: session_activations id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.session_activations ALTER COLUMN id SET DEFAULT nextval('public.session_activations_id_seq'::regclass);
+
+
+--
+-- Name: settings id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.settings ALTER COLUMN id SET DEFAULT nextval('public.settings_id_seq'::regclass);
+
+
+--
+-- Name: sharekeys id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.sharekeys ALTER COLUMN id SET DEFAULT nextval('public.sharekeys_id_seq'::regclass);
+
+
+--
+-- Name: site_uploads id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.site_uploads ALTER COLUMN id SET DEFAULT nextval('public.site_uploads_id_seq'::regclass);
+
+
+--
+-- Name: status_pins id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.status_pins ALTER COLUMN id SET DEFAULT nextval('public.status_pins_id_seq'::regclass);
+
+
+--
+-- Name: status_stats id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.status_stats ALTER COLUMN id SET DEFAULT nextval('public.status_stats_id_seq'::regclass);
+
+
+--
+-- Name: stream_entries id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.stream_entries ALTER COLUMN id SET DEFAULT nextval('public.stream_entries_id_seq'::regclass);
+
+
+--
+-- Name: tags id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.tags ALTER COLUMN id SET DEFAULT nextval('public.tags_id_seq'::regclass);
+
+
+--
+-- Name: tombstones id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.tombstones ALTER COLUMN id SET DEFAULT nextval('public.tombstones_id_seq'::regclass);
+
+
+--
+-- Name: user_invite_requests id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.user_invite_requests ALTER COLUMN id SET DEFAULT nextval('public.user_invite_requests_id_seq'::regclass);
+
+
+--
+-- Name: users id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
+
+
+--
+-- Name: web_push_subscriptions id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.web_push_subscriptions ALTER COLUMN id SET DEFAULT nextval('public.web_push_subscriptions_id_seq'::regclass);
+
+
+--
+-- Name: web_settings id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.web_settings ALTER COLUMN id SET DEFAULT nextval('public.web_settings_id_seq'::regclass);
+
+
+--
+-- Name: account_conversations account_conversations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_conversations
+    ADD CONSTRAINT account_conversations_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: account_domain_blocks account_domain_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_domain_blocks
+    ADD CONSTRAINT account_domain_blocks_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: account_identity_proofs account_identity_proofs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_identity_proofs
+    ADD CONSTRAINT account_identity_proofs_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: account_moderation_notes account_moderation_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_moderation_notes
+    ADD CONSTRAINT account_moderation_notes_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: account_pins account_pins_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_pins
+    ADD CONSTRAINT account_pins_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: account_stats account_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_stats
+    ADD CONSTRAINT account_stats_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: account_tag_stats account_tag_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_tag_stats
+    ADD CONSTRAINT account_tag_stats_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: account_warning_presets account_warning_presets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_warning_presets
+    ADD CONSTRAINT account_warning_presets_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: account_warnings account_warnings_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_warnings
+    ADD CONSTRAINT account_warnings_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: accounts accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.accounts
+    ADD CONSTRAINT accounts_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: admin_action_logs admin_action_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.admin_action_logs
+    ADD CONSTRAINT admin_action_logs_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.ar_internal_metadata
+    ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
+
+
+--
+-- Name: backups backups_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.backups
+    ADD CONSTRAINT backups_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: blocks blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.blocks
+    ADD CONSTRAINT blocks_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: bookmarks bookmarks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.bookmarks
+    ADD CONSTRAINT bookmarks_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: conversation_kicks conversation_kicks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.conversation_kicks
+    ADD CONSTRAINT conversation_kicks_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: conversation_mutes conversation_mutes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.conversation_mutes
+    ADD CONSTRAINT conversation_mutes_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: conversations conversations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.conversations
+    ADD CONSTRAINT conversations_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: custom_emojis custom_emojis_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.custom_emojis
+    ADD CONSTRAINT custom_emojis_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: custom_filters custom_filters_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.custom_filters
+    ADD CONSTRAINT custom_filters_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: destructing_statuses destructing_statuses_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.destructing_statuses
+    ADD CONSTRAINT destructing_statuses_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: domain_blocks domain_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.domain_blocks
+    ADD CONSTRAINT domain_blocks_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: email_domain_blocks email_domain_blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.email_domain_blocks
+    ADD CONSTRAINT email_domain_blocks_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: favourites favourites_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.favourites
+    ADD CONSTRAINT favourites_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: featured_tags featured_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.featured_tags
+    ADD CONSTRAINT featured_tags_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: follow_requests follow_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.follow_requests
+    ADD CONSTRAINT follow_requests_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: follows follows_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.follows
+    ADD CONSTRAINT follows_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: identities identities_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.identities
+    ADD CONSTRAINT identities_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: imported_statuses imported_statuses_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.imported_statuses
+    ADD CONSTRAINT imported_statuses_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: imports imports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.imports
+    ADD CONSTRAINT imports_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: invites invites_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.invites
+    ADD CONSTRAINT invites_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: linked_users linked_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.linked_users
+    ADD CONSTRAINT linked_users_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: list_accounts list_accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.list_accounts
+    ADD CONSTRAINT list_accounts_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: lists lists_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.lists
+    ADD CONSTRAINT lists_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: media_attachments media_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.media_attachments
+    ADD CONSTRAINT media_attachments_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: mentions mentions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.mentions
+    ADD CONSTRAINT mentions_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: mutes mutes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.mutes
+    ADD CONSTRAINT mutes_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: notifications notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.notifications
+    ADD CONSTRAINT notifications_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: oauth_access_grants oauth_access_grants_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.oauth_access_grants
+    ADD CONSTRAINT oauth_access_grants_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: oauth_access_tokens oauth_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.oauth_access_tokens
+    ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: oauth_applications oauth_applications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.oauth_applications
+    ADD CONSTRAINT oauth_applications_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: pghero_space_stats pghero_space_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.pghero_space_stats
+    ADD CONSTRAINT pghero_space_stats_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: poll_votes poll_votes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.poll_votes
+    ADD CONSTRAINT poll_votes_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: polls polls_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.polls
+    ADD CONSTRAINT polls_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: preview_cards preview_cards_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.preview_cards
+    ADD CONSTRAINT preview_cards_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: queued_boosts queued_boosts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.queued_boosts
+    ADD CONSTRAINT queued_boosts_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: relays relays_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.relays
+    ADD CONSTRAINT relays_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: report_notes report_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.report_notes
+    ADD CONSTRAINT report_notes_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: reports reports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.reports
+    ADD CONSTRAINT reports_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: scheduled_statuses scheduled_statuses_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.scheduled_statuses
+    ADD CONSTRAINT scheduled_statuses_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.schema_migrations
+    ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
+
+
+--
+-- Name: session_activations session_activations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.session_activations
+    ADD CONSTRAINT session_activations_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: settings settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.settings
+    ADD CONSTRAINT settings_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: sharekeys sharekeys_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.sharekeys
+    ADD CONSTRAINT sharekeys_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: site_uploads site_uploads_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.site_uploads
+    ADD CONSTRAINT site_uploads_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: status_pins status_pins_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.status_pins
+    ADD CONSTRAINT status_pins_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: status_stats status_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.status_stats
+    ADD CONSTRAINT status_stats_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: statuses statuses_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statuses
+    ADD CONSTRAINT statuses_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: stream_entries stream_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.stream_entries
+    ADD CONSTRAINT stream_entries_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: tags tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.tags
+    ADD CONSTRAINT tags_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: tombstones tombstones_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.tombstones
+    ADD CONSTRAINT tombstones_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: user_invite_requests user_invite_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.user_invite_requests
+    ADD CONSTRAINT user_invite_requests_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.users
+    ADD CONSTRAINT users_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: web_push_subscriptions web_push_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.web_push_subscriptions
+    ADD CONSTRAINT web_push_subscriptions_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: web_settings web_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.web_settings
+    ADD CONSTRAINT web_settings_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: account_activity; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX account_activity ON public.notifications USING btree (account_id, activity_id, activity_type);
+
+
+--
+-- Name: hashtag_search_index; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX hashtag_search_index ON public.tags USING btree (lower((name)::text) text_pattern_ops);
+
+
+--
+-- Name: index_account_conversations_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_account_conversations_on_account_id ON public.account_conversations USING btree (account_id);
+
+
+--
+-- Name: index_account_conversations_on_conversation_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_account_conversations_on_conversation_id ON public.account_conversations USING btree (conversation_id);
+
+
+--
+-- Name: index_account_domain_blocks_on_account_id_and_domain; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_account_domain_blocks_on_account_id_and_domain ON public.account_domain_blocks USING btree (account_id, domain);
+
+
+--
+-- Name: index_account_identity_proofs_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_account_identity_proofs_on_account_id ON public.account_identity_proofs USING btree (account_id);
+
+
+--
+-- Name: index_account_moderation_notes_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_account_moderation_notes_on_account_id ON public.account_moderation_notes USING btree (account_id);
+
+
+--
+-- Name: index_account_moderation_notes_on_target_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_account_moderation_notes_on_target_account_id ON public.account_moderation_notes USING btree (target_account_id);
+
+
+--
+-- Name: index_account_pins_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_account_pins_on_account_id ON public.account_pins USING btree (account_id);
+
+
+--
+-- Name: index_account_pins_on_account_id_and_target_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_account_pins_on_account_id_and_target_account_id ON public.account_pins USING btree (account_id, target_account_id);
+
+
+--
+-- Name: index_account_pins_on_target_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_account_pins_on_target_account_id ON public.account_pins USING btree (target_account_id);
+
+
+--
+-- Name: index_account_proofs_on_account_and_provider_and_username; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_account_proofs_on_account_and_provider_and_username ON public.account_identity_proofs USING btree (account_id, provider, provider_username);
+
+
+--
+-- Name: index_account_stats_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_account_stats_on_account_id ON public.account_stats USING btree (account_id);
+
+
+--
+-- Name: index_account_tag_stats_on_tag_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_account_tag_stats_on_tag_id ON public.account_tag_stats USING btree (tag_id);
+
+
+--
+-- Name: index_account_warnings_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_account_warnings_on_account_id ON public.account_warnings USING btree (account_id);
+
+
+--
+-- Name: index_account_warnings_on_target_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_account_warnings_on_target_account_id ON public.account_warnings USING btree (target_account_id);
+
+
+--
+-- Name: index_accounts_on_moved_to_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_accounts_on_moved_to_account_id ON public.accounts USING btree (moved_to_account_id);
+
+
+--
+-- Name: index_accounts_on_uri; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_accounts_on_uri ON public.accounts USING btree (uri);
+
+
+--
+-- Name: index_accounts_on_url; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_accounts_on_url ON public.accounts USING btree (url);
+
+
+--
+-- Name: index_accounts_on_username_and_domain_lower; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_accounts_on_username_and_domain_lower ON public.accounts USING btree (lower((username)::text), lower((domain)::text));
+
+
+--
+-- Name: index_accounts_tags_on_account_id_and_tag_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_accounts_tags_on_account_id_and_tag_id ON public.accounts_tags USING btree (account_id, tag_id);
+
+
+--
+-- Name: index_accounts_tags_on_tag_id_and_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_accounts_tags_on_tag_id_and_account_id ON public.accounts_tags USING btree (tag_id, account_id);
+
+
+--
+-- Name: index_admin_action_logs_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_admin_action_logs_on_account_id ON public.admin_action_logs USING btree (account_id);
+
+
+--
+-- Name: index_admin_action_logs_on_target_type_and_target_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_admin_action_logs_on_target_type_and_target_id ON public.admin_action_logs USING btree (target_type, target_id);
+
+
+--
+-- Name: index_blocks_on_account_id_and_target_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_blocks_on_account_id_and_target_account_id ON public.blocks USING btree (account_id, target_account_id);
+
+
+--
+-- Name: index_blocks_on_target_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_blocks_on_target_account_id ON public.blocks USING btree (target_account_id);
+
+
+--
+-- Name: index_bookmarks_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_bookmarks_on_account_id ON public.bookmarks USING btree (account_id);
+
+
+--
+-- Name: index_bookmarks_on_account_id_and_status_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_bookmarks_on_account_id_and_status_id ON public.bookmarks USING btree (account_id, status_id);
+
+
+--
+-- Name: index_bookmarks_on_status_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_bookmarks_on_status_id ON public.bookmarks USING btree (status_id);
+
+
+--
+-- Name: index_conversation_kicks_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_conversation_kicks_on_account_id ON public.conversation_kicks USING btree (account_id);
+
+
+--
+-- Name: index_conversation_kicks_on_account_id_and_conversation_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_conversation_kicks_on_account_id_and_conversation_id ON public.conversation_kicks USING btree (account_id, conversation_id);
+
+
+--
+-- Name: index_conversation_kicks_on_conversation_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_conversation_kicks_on_conversation_id ON public.conversation_kicks USING btree (conversation_id);
+
+
+--
+-- Name: index_conversation_mutes_on_account_id_and_conversation_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_conversation_mutes_on_account_id_and_conversation_id ON public.conversation_mutes USING btree (account_id, conversation_id);
+
+
+--
+-- Name: index_conversations_on_uri; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_conversations_on_uri ON public.conversations USING btree (uri);
+
+
+--
+-- Name: index_custom_emojis_on_shortcode_and_domain; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_custom_emojis_on_shortcode_and_domain ON public.custom_emojis USING btree (shortcode, domain);
+
+
+--
+-- Name: index_custom_filters_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_custom_filters_on_account_id ON public.custom_filters USING btree (account_id);
+
+
+--
+-- Name: index_destructing_statuses_on_delete_after; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_destructing_statuses_on_delete_after ON public.destructing_statuses USING btree (delete_after);
+
+
+--
+-- Name: index_destructing_statuses_on_status_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_destructing_statuses_on_status_id ON public.destructing_statuses USING btree (status_id);
+
+
+--
+-- Name: index_domain_blocks_on_domain; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_domain_blocks_on_domain ON public.domain_blocks USING btree (domain);
+
+
+--
+-- Name: index_email_domain_blocks_on_domain; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_email_domain_blocks_on_domain ON public.email_domain_blocks USING btree (domain);
+
+
+--
+-- Name: index_favourites_on_account_id_and_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_favourites_on_account_id_and_id ON public.favourites USING btree (account_id, id);
+
+
+--
+-- Name: index_favourites_on_account_id_and_status_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_favourites_on_account_id_and_status_id ON public.favourites USING btree (account_id, status_id);
+
+
+--
+-- Name: index_favourites_on_status_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_favourites_on_status_id ON public.favourites USING btree (status_id);
+
+
+--
+-- Name: index_featured_tags_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_featured_tags_on_account_id ON public.featured_tags USING btree (account_id);
+
+
+--
+-- Name: index_featured_tags_on_tag_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_featured_tags_on_tag_id ON public.featured_tags USING btree (tag_id);
+
+
+--
+-- Name: index_follow_requests_on_account_id_and_target_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_follow_requests_on_account_id_and_target_account_id ON public.follow_requests USING btree (account_id, target_account_id);
+
+
+--
+-- Name: index_follows_on_account_id_and_target_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_follows_on_account_id_and_target_account_id ON public.follows USING btree (account_id, target_account_id);
+
+
+--
+-- Name: index_follows_on_target_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_follows_on_target_account_id ON public.follows USING btree (target_account_id);
+
+
+--
+-- Name: index_identities_on_user_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_identities_on_user_id ON public.identities USING btree (user_id);
+
+
+--
+-- Name: index_imported_statuses_on_origin; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_imported_statuses_on_origin ON public.imported_statuses USING btree (origin);
+
+
+--
+-- Name: index_imported_statuses_on_status_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_imported_statuses_on_status_id ON public.imported_statuses USING btree (status_id);
+
+
+--
+-- Name: index_invites_on_code; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_invites_on_code ON public.invites USING btree (code);
+
+
+--
+-- Name: index_invites_on_user_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_invites_on_user_id ON public.invites USING btree (user_id);
+
+
+--
+-- Name: index_linked_users_on_target_user_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_linked_users_on_target_user_id ON public.linked_users USING btree (target_user_id);
+
+
+--
+-- Name: index_linked_users_on_user_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_linked_users_on_user_id ON public.linked_users USING btree (user_id);
+
+
+--
+-- Name: index_linked_users_on_user_id_and_target_user_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_linked_users_on_user_id_and_target_user_id ON public.linked_users USING btree (user_id, target_user_id);
+
+
+--
+-- Name: index_list_accounts_on_account_id_and_list_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_list_accounts_on_account_id_and_list_id ON public.list_accounts USING btree (account_id, list_id);
+
+
+--
+-- Name: index_list_accounts_on_follow_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_list_accounts_on_follow_id ON public.list_accounts USING btree (follow_id);
+
+
+--
+-- Name: index_list_accounts_on_list_id_and_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_list_accounts_on_list_id_and_account_id ON public.list_accounts USING btree (list_id, account_id);
+
+
+--
+-- Name: index_lists_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_lists_on_account_id ON public.lists USING btree (account_id);
+
+
+--
+-- Name: index_media_attachments_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_media_attachments_on_account_id ON public.media_attachments USING btree (account_id);
+
+
+--
+-- Name: index_media_attachments_on_scheduled_status_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_media_attachments_on_scheduled_status_id ON public.media_attachments USING btree (scheduled_status_id);
+
+
+--
+-- Name: index_media_attachments_on_shortcode; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_media_attachments_on_shortcode ON public.media_attachments USING btree (shortcode);
+
+
+--
+-- Name: index_media_attachments_on_status_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_media_attachments_on_status_id ON public.media_attachments USING btree (status_id);
+
+
+--
+-- Name: index_mentions_on_account_id_and_status_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_mentions_on_account_id_and_status_id ON public.mentions USING btree (account_id, status_id);
+
+
+--
+-- Name: index_mentions_on_status_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_mentions_on_status_id ON public.mentions USING btree (status_id);
+
+
+--
+-- Name: index_mutes_on_account_id_and_target_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_mutes_on_account_id_and_target_account_id ON public.mutes USING btree (account_id, target_account_id);
+
+
+--
+-- Name: index_mutes_on_target_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_mutes_on_target_account_id ON public.mutes USING btree (target_account_id);
+
+
+--
+-- Name: index_notifications_on_account_id_and_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_notifications_on_account_id_and_id ON public.notifications USING btree (account_id, id DESC);
+
+
+--
+-- Name: index_notifications_on_activity_id_and_activity_type; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_notifications_on_activity_id_and_activity_type ON public.notifications USING btree (activity_id, activity_type);
+
+
+--
+-- Name: index_notifications_on_from_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_notifications_on_from_account_id ON public.notifications USING btree (from_account_id);
+
+
+--
+-- Name: index_oauth_access_grants_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON public.oauth_access_grants USING btree (resource_owner_id);
+
+
+--
+-- Name: index_oauth_access_grants_on_token; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON public.oauth_access_grants USING btree (token);
+
+
+--
+-- Name: index_oauth_access_tokens_on_refresh_token; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_oauth_access_tokens_on_refresh_token ON public.oauth_access_tokens USING btree (refresh_token);
+
+
+--
+-- Name: index_oauth_access_tokens_on_resource_owner_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_oauth_access_tokens_on_resource_owner_id ON public.oauth_access_tokens USING btree (resource_owner_id);
+
+
+--
+-- Name: index_oauth_access_tokens_on_token; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_oauth_access_tokens_on_token ON public.oauth_access_tokens USING btree (token);
+
+
+--
+-- Name: index_oauth_applications_on_owner_id_and_owner_type; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_oauth_applications_on_owner_id_and_owner_type ON public.oauth_applications USING btree (owner_id, owner_type);
+
+
+--
+-- Name: index_oauth_applications_on_uid; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_oauth_applications_on_uid ON public.oauth_applications USING btree (uid);
+
+
+--
+-- Name: index_pghero_space_stats_on_database_and_captured_at; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_pghero_space_stats_on_database_and_captured_at ON public.pghero_space_stats USING btree (database, captured_at);
+
+
+--
+-- Name: index_poll_votes_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_poll_votes_on_account_id ON public.poll_votes USING btree (account_id);
+
+
+--
+-- Name: index_poll_votes_on_poll_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_poll_votes_on_poll_id ON public.poll_votes USING btree (poll_id);
+
+
+--
+-- Name: index_polls_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_polls_on_account_id ON public.polls USING btree (account_id);
+
+
+--
+-- Name: index_polls_on_status_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_polls_on_status_id ON public.polls USING btree (status_id);
+
+
+--
+-- Name: index_preview_cards_on_url; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_preview_cards_on_url ON public.preview_cards USING btree (url);
+
+
+--
+-- Name: index_preview_cards_statuses_on_status_id_and_preview_card_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_preview_cards_statuses_on_status_id_and_preview_card_id ON public.preview_cards_statuses USING btree (status_id, preview_card_id);
+
+
+--
+-- Name: index_queued_boosts_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_queued_boosts_on_account_id ON public.queued_boosts USING btree (account_id);
+
+
+--
+-- Name: index_queued_boosts_on_account_id_and_status_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_queued_boosts_on_account_id_and_status_id ON public.queued_boosts USING btree (account_id, status_id);
+
+
+--
+-- Name: index_queued_boosts_on_status_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_queued_boosts_on_status_id ON public.queued_boosts USING btree (status_id);
+
+
+--
+-- Name: index_report_notes_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_report_notes_on_account_id ON public.report_notes USING btree (account_id);
+
+
+--
+-- Name: index_report_notes_on_report_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_report_notes_on_report_id ON public.report_notes USING btree (report_id);
+
+
+--
+-- Name: index_reports_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_reports_on_account_id ON public.reports USING btree (account_id);
+
+
+--
+-- Name: index_reports_on_target_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_reports_on_target_account_id ON public.reports USING btree (target_account_id);
+
+
+--
+-- Name: index_scheduled_statuses_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_scheduled_statuses_on_account_id ON public.scheduled_statuses USING btree (account_id);
+
+
+--
+-- Name: index_scheduled_statuses_on_scheduled_at; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_scheduled_statuses_on_scheduled_at ON public.scheduled_statuses USING btree (scheduled_at);
+
+
+--
+-- Name: index_session_activations_on_access_token_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_session_activations_on_access_token_id ON public.session_activations USING btree (access_token_id);
+
+
+--
+-- Name: index_session_activations_on_session_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_session_activations_on_session_id ON public.session_activations USING btree (session_id);
+
+
+--
+-- Name: index_session_activations_on_user_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_session_activations_on_user_id ON public.session_activations USING btree (user_id);
+
+
+--
+-- Name: index_settings_on_thing_type_and_thing_id_and_var; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_settings_on_thing_type_and_thing_id_and_var ON public.settings USING btree (thing_type, thing_id, var);
+
+
+--
+-- Name: index_sharekeys_on_status_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_sharekeys_on_status_id ON public.sharekeys USING btree (status_id);
+
+
+--
+-- Name: index_site_uploads_on_var; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_site_uploads_on_var ON public.site_uploads USING btree (var);
+
+
+--
+-- Name: index_status_pins_on_account_id_and_status_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_status_pins_on_account_id_and_status_id ON public.status_pins USING btree (account_id, status_id);
+
+
+--
+-- Name: index_status_stats_on_status_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_status_stats_on_status_id ON public.status_stats USING btree (status_id);
+
+
+--
+-- Name: index_statuses_20180106; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statuses_20180106 ON public.statuses USING btree (account_id, id DESC, visibility, updated_at);
+
+
+--
+-- Name: index_statuses_on_account_id_and_id_and_visibility; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statuses_on_account_id_and_id_and_visibility ON public.statuses USING btree (account_id, id DESC, visibility) WHERE (visibility = ANY (ARRAY[0, 1, 2, 4]));
+
+
+--
+-- Name: index_statuses_on_in_reply_to_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statuses_on_in_reply_to_account_id ON public.statuses USING btree (in_reply_to_account_id);
+
+
+--
+-- Name: index_statuses_on_in_reply_to_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statuses_on_in_reply_to_id ON public.statuses USING btree (in_reply_to_id);
+
+
+--
+-- Name: index_statuses_on_network; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statuses_on_network ON public.statuses USING btree (network) WHERE network;
+
+
+--
+-- Name: index_statuses_on_reblog_of_id_and_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statuses_on_reblog_of_id_and_account_id ON public.statuses USING btree (reblog_of_id, account_id);
+
+
+--
+-- Name: index_statuses_on_uri; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_statuses_on_uri ON public.statuses USING btree (uri);
+
+
+--
+-- Name: index_statuses_tags_on_status_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statuses_tags_on_status_id ON public.statuses_tags USING btree (status_id);
+
+
+--
+-- Name: index_statuses_tags_on_tag_id_and_status_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_statuses_tags_on_tag_id_and_status_id ON public.statuses_tags USING btree (tag_id, status_id);
+
+
+--
+-- Name: index_stream_entries_on_account_id_and_activity_type_and_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_stream_entries_on_account_id_and_activity_type_and_id ON public.stream_entries USING btree (account_id, activity_type, id);
+
+
+--
+-- Name: index_stream_entries_on_activity_id_and_activity_type; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_stream_entries_on_activity_id_and_activity_type ON public.stream_entries USING btree (activity_id, activity_type);
+
+
+--
+-- Name: index_tags_on_name; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_tags_on_name ON public.tags USING btree (name);
+
+
+--
+-- Name: index_tags_on_unlisted; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_tags_on_unlisted ON public.tags USING btree (unlisted) WHERE unlisted;
+
+
+--
+-- Name: index_tombstones_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_tombstones_on_account_id ON public.tombstones USING btree (account_id);
+
+
+--
+-- Name: index_tombstones_on_uri; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_tombstones_on_uri ON public.tombstones USING btree (uri);
+
+
+--
+-- Name: index_unique_conversations; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_unique_conversations ON public.account_conversations USING btree (account_id, conversation_id, participant_account_ids);
+
+
+--
+-- Name: index_user_invite_requests_on_user_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_user_invite_requests_on_user_id ON public.user_invite_requests USING btree (user_id);
+
+
+--
+-- Name: index_users_on_account_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_users_on_account_id ON public.users USING btree (account_id);
+
+
+--
+-- Name: index_users_on_confirmation_token; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_users_on_confirmation_token ON public.users USING btree (confirmation_token);
+
+
+--
+-- Name: index_users_on_created_by_application_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_users_on_created_by_application_id ON public.users USING btree (created_by_application_id);
+
+
+--
+-- Name: index_users_on_email; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_users_on_email ON public.users USING btree (email);
+
+
+--
+-- Name: index_users_on_reset_password_token; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_users_on_reset_password_token ON public.users USING btree (reset_password_token);
+
+
+--
+-- Name: index_web_push_subscriptions_on_access_token_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_web_push_subscriptions_on_access_token_id ON public.web_push_subscriptions USING btree (access_token_id);
+
+
+--
+-- Name: index_web_push_subscriptions_on_user_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_web_push_subscriptions_on_user_id ON public.web_push_subscriptions USING btree (user_id);
+
+
+--
+-- Name: index_web_settings_on_user_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_web_settings_on_user_id ON public.web_settings USING btree (user_id);
+
+
+--
+-- Name: search_index; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX search_index ON public.accounts USING gin ((((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: statuses_text_vector_idx; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX statuses_text_vector_idx ON public.statuses USING gin (tsv);
+
+
+--
+-- Name: web_settings fk_11910667b2; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.web_settings
+    ADD CONSTRAINT fk_11910667b2 FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
+
+--
+-- Name: account_domain_blocks fk_206c6029bd; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_domain_blocks
+    ADD CONSTRAINT fk_206c6029bd FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: conversation_mutes fk_225b4212bb; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.conversation_mutes
+    ADD CONSTRAINT fk_225b4212bb FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: statuses_tags fk_3081861e21; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statuses_tags
+    ADD CONSTRAINT fk_3081861e21 FOREIGN KEY (tag_id) REFERENCES public.tags(id) ON DELETE CASCADE;
+
+
+--
+-- Name: follows fk_32ed1b5560; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.follows
+    ADD CONSTRAINT fk_32ed1b5560 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: oauth_access_grants fk_34d54b0a33; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.oauth_access_grants
+    ADD CONSTRAINT fk_34d54b0a33 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) ON DELETE CASCADE;
+
+
+--
+-- Name: blocks fk_4269e03e65; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.blocks
+    ADD CONSTRAINT fk_4269e03e65 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: reports fk_4b81f7522c; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.reports
+    ADD CONSTRAINT fk_4b81f7522c FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: users fk_50500f500d; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.users
+    ADD CONSTRAINT fk_50500f500d FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: stream_entries fk_5659b17554; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.stream_entries
+    ADD CONSTRAINT fk_5659b17554 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: favourites fk_5eb6c2b873; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.favourites
+    ADD CONSTRAINT fk_5eb6c2b873 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: oauth_access_grants fk_63b044929b; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.oauth_access_grants
+    ADD CONSTRAINT fk_63b044929b FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
+
+--
+-- Name: imports fk_6db1b6e408; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.imports
+    ADD CONSTRAINT fk_6db1b6e408 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: follows fk_745ca29eac; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.follows
+    ADD CONSTRAINT fk_745ca29eac FOREIGN KEY (target_account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: follow_requests fk_76d644b0e7; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.follow_requests
+    ADD CONSTRAINT fk_76d644b0e7 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: follow_requests fk_9291ec025d; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.follow_requests
+    ADD CONSTRAINT fk_9291ec025d FOREIGN KEY (target_account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: blocks fk_9571bfabc1; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.blocks
+    ADD CONSTRAINT fk_9571bfabc1 FOREIGN KEY (target_account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: session_activations fk_957e5bda89; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.session_activations
+    ADD CONSTRAINT fk_957e5bda89 FOREIGN KEY (access_token_id) REFERENCES public.oauth_access_tokens(id) ON DELETE CASCADE;
+
+
+--
+-- Name: media_attachments fk_96dd81e81b; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.media_attachments
+    ADD CONSTRAINT fk_96dd81e81b FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE SET NULL;
+
+
+--
+-- Name: mentions fk_970d43f9d1; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.mentions
+    ADD CONSTRAINT fk_970d43f9d1 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: statuses fk_9bda1543f7; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statuses
+    ADD CONSTRAINT fk_9bda1543f7 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: oauth_applications fk_b0988c7c0a; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.oauth_applications
+    ADD CONSTRAINT fk_b0988c7c0a FOREIGN KEY (owner_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
+
+--
+-- Name: favourites fk_b0e856845e; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.favourites
+    ADD CONSTRAINT fk_b0e856845e FOREIGN KEY (status_id) REFERENCES public.statuses(id) ON DELETE CASCADE;
+
+
+--
+-- Name: mutes fk_b8d8daf315; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.mutes
+    ADD CONSTRAINT fk_b8d8daf315 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: reports fk_bca45b75fd; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.reports
+    ADD CONSTRAINT fk_bca45b75fd FOREIGN KEY (action_taken_by_account_id) REFERENCES public.accounts(id) ON DELETE SET NULL;
+
+
+--
+-- Name: identities fk_bea040f377; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.identities
+    ADD CONSTRAINT fk_bea040f377 FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
+
+--
+-- Name: notifications fk_c141c8ee55; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.notifications
+    ADD CONSTRAINT fk_c141c8ee55 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: statuses fk_c7fa917661; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statuses
+    ADD CONSTRAINT fk_c7fa917661 FOREIGN KEY (in_reply_to_account_id) REFERENCES public.accounts(id) ON DELETE SET NULL;
+
+
+--
+-- Name: status_pins fk_d4cb435b62; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.status_pins
+    ADD CONSTRAINT fk_d4cb435b62 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: session_activations fk_e5fda67334; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.session_activations
+    ADD CONSTRAINT fk_e5fda67334 FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
+
+--
+-- Name: oauth_access_tokens fk_e84df68546; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.oauth_access_tokens
+    ADD CONSTRAINT fk_e84df68546 FOREIGN KEY (resource_owner_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
+
+--
+-- Name: reports fk_eb37af34f0; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.reports
+    ADD CONSTRAINT fk_eb37af34f0 FOREIGN KEY (target_account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: mutes fk_eecff219ea; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.mutes
+    ADD CONSTRAINT fk_eecff219ea FOREIGN KEY (target_account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: oauth_access_tokens fk_f5fc4c1ee3; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.oauth_access_tokens
+    ADD CONSTRAINT fk_f5fc4c1ee3 FOREIGN KEY (application_id) REFERENCES public.oauth_applications(id) ON DELETE CASCADE;
+
+
+--
+-- Name: notifications fk_fbd6b0bf9e; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.notifications
+    ADD CONSTRAINT fk_fbd6b0bf9e FOREIGN KEY (from_account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: backups fk_rails_096669d221; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.backups
+    ADD CONSTRAINT fk_rails_096669d221 FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE SET NULL;
+
+
+--
+-- Name: conversation_kicks fk_rails_110ba8aa50; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.conversation_kicks
+    ADD CONSTRAINT fk_rails_110ba8aa50 FOREIGN KEY (conversation_id) REFERENCES public.conversations(id) ON DELETE CASCADE;
+
+
+--
+-- Name: bookmarks fk_rails_11207ffcfd; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.bookmarks
+    ADD CONSTRAINT fk_rails_11207ffcfd FOREIGN KEY (status_id) REFERENCES public.statuses(id) ON DELETE CASCADE;
+
+
+--
+-- Name: account_conversations fk_rails_1491654f9f; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_conversations
+    ADD CONSTRAINT fk_rails_1491654f9f FOREIGN KEY (conversation_id) REFERENCES public.conversations(id) ON DELETE CASCADE;
+
+
+--
+-- Name: featured_tags fk_rails_174efcf15f; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.featured_tags
+    ADD CONSTRAINT fk_rails_174efcf15f FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: account_tag_stats fk_rails_1fa34bab2d; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_tag_stats
+    ADD CONSTRAINT fk_rails_1fa34bab2d FOREIGN KEY (tag_id) REFERENCES public.tags(id) ON DELETE CASCADE;
+
+
+--
+-- Name: account_stats fk_rails_215bb31ff1; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_stats
+    ADD CONSTRAINT fk_rails_215bb31ff1 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: accounts fk_rails_2320833084; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.accounts
+    ADD CONSTRAINT fk_rails_2320833084 FOREIGN KEY (moved_to_account_id) REFERENCES public.accounts(id) ON DELETE SET NULL;
+
+
+--
+-- Name: featured_tags fk_rails_23a9055c7c; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.featured_tags
+    ADD CONSTRAINT fk_rails_23a9055c7c FOREIGN KEY (tag_id) REFERENCES public.tags(id) ON DELETE CASCADE;
+
+
+--
+-- Name: scheduled_statuses fk_rails_23bd9018f9; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.scheduled_statuses
+    ADD CONSTRAINT fk_rails_23bd9018f9 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: statuses fk_rails_256483a9ab; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statuses
+    ADD CONSTRAINT fk_rails_256483a9ab FOREIGN KEY (reblog_of_id) REFERENCES public.statuses(id) ON DELETE CASCADE;
+
+
+--
+-- Name: media_attachments fk_rails_31fc5aeef1; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.media_attachments
+    ADD CONSTRAINT fk_rails_31fc5aeef1 FOREIGN KEY (scheduled_status_id) REFERENCES public.scheduled_statuses(id) ON DELETE SET NULL;
+
+
+--
+-- Name: user_invite_requests fk_rails_3773f15361; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.user_invite_requests
+    ADD CONSTRAINT fk_rails_3773f15361 FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
+
+--
+-- Name: lists fk_rails_3853b78dac; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.lists
+    ADD CONSTRAINT fk_rails_3853b78dac FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: polls fk_rails_3e0d9f1115; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.polls
+    ADD CONSTRAINT fk_rails_3e0d9f1115 FOREIGN KEY (status_id) REFERENCES public.statuses(id) ON DELETE CASCADE;
+
+
+--
+-- Name: media_attachments fk_rails_3ec0cfdd70; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.media_attachments
+    ADD CONSTRAINT fk_rails_3ec0cfdd70 FOREIGN KEY (status_id) REFERENCES public.statuses(id) ON DELETE SET NULL;
+
+
+--
+-- Name: account_moderation_notes fk_rails_3f8b75089b; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_moderation_notes
+    ADD CONSTRAINT fk_rails_3f8b75089b FOREIGN KEY (account_id) REFERENCES public.accounts(id);
+
+
+--
+-- Name: list_accounts fk_rails_40f9cc29f1; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.list_accounts
+    ADD CONSTRAINT fk_rails_40f9cc29f1 FOREIGN KEY (follow_id) REFERENCES public.follows(id) ON DELETE CASCADE;
+
+
+--
+-- Name: status_stats fk_rails_4a247aac42; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.status_stats
+    ADD CONSTRAINT fk_rails_4a247aac42 FOREIGN KEY (status_id) REFERENCES public.statuses(id) ON DELETE CASCADE;
+
+
+--
+-- Name: sharekeys fk_rails_4d8ae841f5; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.sharekeys
+    ADD CONSTRAINT fk_rails_4d8ae841f5 FOREIGN KEY (status_id) REFERENCES public.statuses(id);
+
+
+--
+-- Name: reports fk_rails_4e7a498fb4; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.reports
+    ADD CONSTRAINT fk_rails_4e7a498fb4 FOREIGN KEY (assigned_account_id) REFERENCES public.accounts(id) ON DELETE SET NULL;
+
+
+--
+-- Name: mentions fk_rails_59edbe2887; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.mentions
+    ADD CONSTRAINT fk_rails_59edbe2887 FOREIGN KEY (status_id) REFERENCES public.statuses(id) ON DELETE CASCADE;
+
+
+--
+-- Name: conversation_mutes fk_rails_5ab139311f; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.conversation_mutes
+    ADD CONSTRAINT fk_rails_5ab139311f FOREIGN KEY (conversation_id) REFERENCES public.conversations(id) ON DELETE CASCADE;
+
+
+--
+-- Name: polls fk_rails_5b19a0c011; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.polls
+    ADD CONSTRAINT fk_rails_5b19a0c011 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: status_pins fk_rails_65c05552f1; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.status_pins
+    ADD CONSTRAINT fk_rails_65c05552f1 FOREIGN KEY (status_id) REFERENCES public.statuses(id) ON DELETE CASCADE;
+
+
+--
+-- Name: conversation_kicks fk_rails_6748274435; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.conversation_kicks
+    ADD CONSTRAINT fk_rails_6748274435 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: account_identity_proofs fk_rails_6a219ca385; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_identity_proofs
+    ADD CONSTRAINT fk_rails_6a219ca385 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: account_conversations fk_rails_6f5278b6e9; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_conversations
+    ADD CONSTRAINT fk_rails_6f5278b6e9 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: linked_users fk_rails_6fc5423edb; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.linked_users
+    ADD CONSTRAINT fk_rails_6fc5423edb FOREIGN KEY (target_user_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
+
+--
+-- Name: web_push_subscriptions fk_rails_751a9f390b; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.web_push_subscriptions
+    ADD CONSTRAINT fk_rails_751a9f390b FOREIGN KEY (access_token_id) REFERENCES public.oauth_access_tokens(id) ON DELETE CASCADE;
+
+
+--
+-- Name: report_notes fk_rails_7fa83a61eb; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.report_notes
+    ADD CONSTRAINT fk_rails_7fa83a61eb FOREIGN KEY (report_id) REFERENCES public.reports(id) ON DELETE CASCADE;
+
+
+--
+-- Name: list_accounts fk_rails_85fee9d6ab; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.list_accounts
+    ADD CONSTRAINT fk_rails_85fee9d6ab FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: custom_filters fk_rails_8b8d786993; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.custom_filters
+    ADD CONSTRAINT fk_rails_8b8d786993 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: users fk_rails_8fb2a43e88; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.users
+    ADD CONSTRAINT fk_rails_8fb2a43e88 FOREIGN KEY (invite_id) REFERENCES public.invites(id) ON DELETE SET NULL;
+
+
+--
+-- Name: queued_boosts fk_rails_940077b3c1; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.queued_boosts
+    ADD CONSTRAINT fk_rails_940077b3c1 FOREIGN KEY (status_id) REFERENCES public.statuses(id) ON DELETE CASCADE;
+
+
+--
+-- Name: statuses fk_rails_94a6f70399; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statuses
+    ADD CONSTRAINT fk_rails_94a6f70399 FOREIGN KEY (in_reply_to_id) REFERENCES public.statuses(id) ON DELETE SET NULL;
+
+
+--
+-- Name: imported_statuses fk_rails_987dbadcf4; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.imported_statuses
+    ADD CONSTRAINT fk_rails_987dbadcf4 FOREIGN KEY (status_id) REFERENCES public.statuses(id);
+
+
+--
+-- Name: bookmarks fk_rails_9f6ac182a6; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.bookmarks
+    ADD CONSTRAINT fk_rails_9f6ac182a6 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: account_pins fk_rails_a176e26c37; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_pins
+    ADD CONSTRAINT fk_rails_a176e26c37 FOREIGN KEY (target_account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: queued_boosts fk_rails_a181b9061d; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.queued_boosts
+    ADD CONSTRAINT fk_rails_a181b9061d FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: account_warnings fk_rails_a65a1bf71b; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_warnings
+    ADD CONSTRAINT fk_rails_a65a1bf71b FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE SET NULL;
+
+
+--
+-- Name: poll_votes fk_rails_a6e6974b7e; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.poll_votes
+    ADD CONSTRAINT fk_rails_a6e6974b7e FOREIGN KEY (poll_id) REFERENCES public.polls(id) ON DELETE CASCADE;
+
+
+--
+-- Name: admin_action_logs fk_rails_a7667297fa; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.admin_action_logs
+    ADD CONSTRAINT fk_rails_a7667297fa FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: account_warnings fk_rails_a7ebbb1e37; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_warnings
+    ADD CONSTRAINT fk_rails_a7ebbb1e37 FOREIGN KEY (target_account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: web_push_subscriptions fk_rails_b006f28dac; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.web_push_subscriptions
+    ADD CONSTRAINT fk_rails_b006f28dac FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
+
+--
+-- Name: linked_users fk_rails_b1049e0cf0; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.linked_users
+    ADD CONSTRAINT fk_rails_b1049e0cf0 FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
+
+--
+-- Name: poll_votes fk_rails_b6c18cf44a; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.poll_votes
+    ADD CONSTRAINT fk_rails_b6c18cf44a FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: report_notes fk_rails_cae66353f3; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.report_notes
+    ADD CONSTRAINT fk_rails_cae66353f3 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: destructing_statuses fk_rails_ce4a892ac3; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.destructing_statuses
+    ADD CONSTRAINT fk_rails_ce4a892ac3 FOREIGN KEY (status_id) REFERENCES public.statuses(id);
+
+
+--
+-- Name: account_pins fk_rails_d44979e5dd; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_pins
+    ADD CONSTRAINT fk_rails_d44979e5dd FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: account_moderation_notes fk_rails_dd62ed5ac3; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.account_moderation_notes
+    ADD CONSTRAINT fk_rails_dd62ed5ac3 FOREIGN KEY (target_account_id) REFERENCES public.accounts(id);
+
+
+--
+-- Name: statuses_tags fk_rails_df0fe11427; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statuses_tags
+    ADD CONSTRAINT fk_rails_df0fe11427 FOREIGN KEY (status_id) REFERENCES public.statuses(id) ON DELETE CASCADE;
+
+
+--
+-- Name: list_accounts fk_rails_e54e356c88; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.list_accounts
+    ADD CONSTRAINT fk_rails_e54e356c88 FOREIGN KEY (list_id) REFERENCES public.lists(id) ON DELETE CASCADE;
+
+
+--
+-- Name: users fk_rails_ecc9536e7c; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.users
+    ADD CONSTRAINT fk_rails_ecc9536e7c FOREIGN KEY (created_by_application_id) REFERENCES public.oauth_applications(id) ON DELETE SET NULL;
+
+
+--
+-- Name: tombstones fk_rails_f95b861449; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.tombstones
+    ADD CONSTRAINT fk_rails_f95b861449 FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
+
+
+--
+-- Name: invites fk_rails_ff69dbb2ac; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.invites
+    ADD CONSTRAINT fk_rails_ff69dbb2ac FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
+
+--
+-- PostgreSQL database dump complete
+--
+
+SET search_path TO "$user", public;
+
+INSERT INTO "schema_migrations" (version) VALUES
+('20160220174730'),
+('20160220211917'),
+('20160221003140'),
+('20160221003621'),
+('20160222122600'),
+('20160222143943'),
+('20160223162837'),
+('20160223164502'),
+('20160223165723'),
+('20160223165855'),
+('20160223171800'),
+('20160224223247'),
+('20160227230233'),
+('20160305115639'),
+('20160306172223'),
+('20160312193225'),
+('20160314164231'),
+('20160316103650'),
+('20160322193748'),
+('20160325130944'),
+('20160826155805'),
+('20160905150353'),
+('20160919221059'),
+('20160920003904'),
+('20160926213048'),
+('20161003142332'),
+('20161003145426'),
+('20161006213403'),
+('20161009120834'),
+('20161027172456'),
+('20161104173623'),
+('20161105130633'),
+('20161116162355'),
+('20161119211120'),
+('20161122163057'),
+('20161123093447'),
+('20161128103007'),
+('20161130142058'),
+('20161130185319'),
+('20161202132159'),
+('20161203164520'),
+('20161205214545'),
+('20161221152630'),
+('20161222201034'),
+('20161222204147'),
+('20170105224407'),
+('20170109120109'),
+('20170112154826'),
+('20170114194937'),
+('20170114203041'),
+('20170119214911'),
+('20170123162658'),
+('20170123203248'),
+('20170125145934'),
+('20170127165745'),
+('20170129000348'),
+('20170205175257'),
+('20170209184350'),
+('20170214110202'),
+('20170217012631'),
+('20170301222600'),
+('20170303212857'),
+('20170304202101'),
+('20170317193015'),
+('20170318214217'),
+('20170322021028'),
+('20170322143850'),
+('20170322162804'),
+('20170330021336'),
+('20170330163835'),
+('20170330164118'),
+('20170403172249'),
+('20170405112956'),
+('20170406215816'),
+('20170409170753'),
+('20170414080609'),
+('20170414132105'),
+('20170418160728'),
+('20170423005413'),
+('20170424003227'),
+('20170424112722'),
+('20170425131920'),
+('20170425202925'),
+('20170427011934'),
+('20170506235850'),
+('20170507000211'),
+('20170507141759'),
+('20170508230434'),
+('20170516072309'),
+('20170520145338'),
+('20170601210557'),
+('20170604144747'),
+('20170606113804'),
+('20170609145826'),
+('20170610000000'),
+('20170623152212'),
+('20170624134742'),
+('20170625140443'),
+('20170711225116'),
+('20170713112503'),
+('20170713175513'),
+('20170713190709'),
+('20170714184731'),
+('20170716191202'),
+('20170718211102'),
+('20170720000000'),
+('20170823162448'),
+('20170824103029'),
+('20170829215220'),
+('20170901141119'),
+('20170901142658'),
+('20170905044538'),
+('20170905165803'),
+('20170913000752'),
+('20170914032032'),
+('20170917153509'),
+('20170918125918'),
+('20170920024819'),
+('20170920032311'),
+('20170924022025'),
+('20170927215609'),
+('20170928082043'),
+('20171005102658'),
+('20171005171936'),
+('20171006142024'),
+('20171009222537'),
+('20171010023049'),
+('20171010025614'),
+('20171020084748'),
+('20171021191900'),
+('20171028221157'),
+('20171107143332'),
+('20171107143624'),
+('20171109012327'),
+('20171114080328'),
+('20171114231651'),
+('20171116161857'),
+('20171118012443'),
+('20171119172437'),
+('20171122120436'),
+('20171125024930'),
+('20171125031751'),
+('20171125185353'),
+('20171125190735'),
+('20171129172043'),
+('20171130000000'),
+('20171201000000'),
+('20171210213213'),
+('20171212195226'),
+('20171226094803'),
+('20180106000232'),
+('20180109143959'),
+('20180204034416'),
+('20180206000000'),
+('20180211015820'),
+('20180304013859'),
+('20180310000000'),
+('20180402031200'),
+('20180402040909'),
+('20180410204633'),
+('20180410220657'),
+('20180416210259'),
+('20180506221944'),
+('20180510214435'),
+('20180510230049'),
+('20180514130000'),
+('20180514140000'),
+('20180528141303'),
+('20180604000556'),
+('20180608213548'),
+('20180609104432'),
+('20180615122121'),
+('20180616192031'),
+('20180617162849'),
+('20180628181026'),
+('20180707154237'),
+('20180707193142'),
+('20180711152640'),
+('20180808175627'),
+('20180812123222'),
+('20180812162710'),
+('20180812173710'),
+('20180813113448'),
+('20180813160548'),
+('20180814171349'),
+('20180820232245'),
+('20180929222014'),
+('20181007025445'),
+('20181010141500'),
+('20181017170937'),
+('20181018205649'),
+('20181024224956'),
+('20181026034033'),
+('20181116165755'),
+('20181116173541'),
+('20181116184611'),
+('20181127130500'),
+('20181127165847'),
+('20181203003808'),
+('20181203021853'),
+('20181204193439'),
+('20181204215309'),
+('20181207011115'),
+('20181213184704'),
+('20181213185533'),
+('20181219235220'),
+('20181226021420'),
+('20190103124649'),
+('20190103124754'),
+('20190117114553'),
+('20190201012802'),
+('20190203180359'),
+('20190225031541'),
+('20190225031625'),
+('20190226003449'),
+('20190304152020'),
+('20190306145741'),
+('20190307234537'),
+('20190314181829'),
+('20190316190352'),
+('20190317135723'),
+('20190325072307'),
+('20190409054914'),
+('20190414162149'),
+('20190415185302'),
+('20190417025855'),
+('20190419040911'),
+('20190419045308'),
+('20190420025523'),
+('20190425165151'),
+('20190427232757'),
+('20190428055312'),
+('20190505072439'),
+('20190506024558'),
+('20190508075055'),
+('20190509163236'),
+('20190509164208'),
+('20190509164727'),
+('20190509183411'),
+('20190509185038'),
+('20190509190505'),
+('20190509201242'),
+('20190509201451'),
+('20190510071027'),
+('20190511134027'),
+('20190511152737'),
+('20190512200918'),
+('20190518044851'),
+('20190518150215'),
+('20190519130537'),
+('20190521003029'),
+('20190521003040'),
+('20190521003341'),
+('20190521003909'),
+('20190522043937'),
+('20190522060455'),
+('20190522060919'),
+('20190523010615'),
+('20190526052454'),
+('20190529143559'),
+('20190531082330'),
+('20190531082452'),
+('20190531084425'),
+('20190714172440'),
+('20190714172721'),
+('20190719121326'),
+('20190719212820'),
+('20190722014444'),
+('20190723152514'),
+('20190724173350'),
+('20190724175247'),
+('20190728201832'),
+('20190730213656'),
+('20190801212756'),
+('20190801213117'),
+('20190801213606'),
+('20190801222645'),
+('20190801222823'),
+('20190803170051'),
+('20190805064643'),
+('20190805203816'),
+('20190806195913'),
+('20190807171841'),
+('20190807172051'),
+('20190807221924'),
+('20190815232125'),
+('20190831022432'),
+('20191009231327'),
+('20191010005320'),
+('20191014164340'),
+('20191014164349'),
+('20191027182731'),
+('20191116233416'),
+('20191118005833'),
+('20191118044943'),
+('20191118064252'),
+('20191118084127'),
+('20191118102858'),
+('20191211235208'),
+('20191212002705'),
+('20191212022020'),
+('20191212022653'),
+('20191212043419'),
+('20191220020429'),
+('20191220020441'),
+('20191221164844'),
+('20191221183232'),
+('20191221195147'),
+('20200108051211'),
+('20200109191740'),
+('20200110072034');
+
+
diff --git a/spec/fabricators/normalized_status_fabricator.rb b/spec/fabricators/normalized_status_fabricator.rb
deleted file mode 100644
index a77857175..000000000
--- a/spec/fabricators/normalized_status_fabricator.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-Fabricator(:normalized_status) do
-  status nil
-  text   "MyText"
-end
diff --git a/spec/models/normalized_status_spec.rb b/spec/models/normalized_status_spec.rb
deleted file mode 100644
index b7b241f8e..000000000
--- a/spec/models/normalized_status_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'rails_helper'
-
-RSpec.describe NormalizedStatus, type: :model do
-  pending "add some examples to (or delete) #{__FILE__}"
-end
diff --git a/streaming/index.js b/streaming/index.js
index db421ff03..fe61c5c2e 100644
--- a/streaming/index.js
+++ b/streaming/index.js
@@ -424,7 +424,7 @@ const startWorker = (workerId) => {
         }
 
         const queries = [
-          client.query(`SELECT 1 FROM blocks WHERE (account_id = $1 AND target_account_id IN (${placeholders(targetAccountIds, 3)})) OR (account_id = $2 AND target_account_id = $1) UNION SELECT 1 FROM mutes WHERE account_id = $1 AND target_account_id IN (${placeholders(targetAccountIds, 3)}) UNION SELECT 1 FROM normalized_statuses WHERE status_id = $3 AND text ${req.invertFilters ? '!~' : '~'} ANY(ARRAY(SELECT f_normalize(phrase) FROM custom_filters WHERE account_id = $1)) UNION SELECT 1 FROM media_attachments WHERE (1 = (SELECT 1 FROM accounts WHERE id = $1 AND filter_undescribed)) AND status_id = $3 AND description IS NULL LIMIT 1`, [req.accountId, unpackedPayload.account.id, unpackedPayload.id].concat(targetAccountIds)),
+          client.query(`SELECT 1 FROM blocks WHERE (account_id = $1 AND target_account_id IN (${placeholders(targetAccountIds, 3)})) OR (account_id = $2 AND target_account_id = $1) UNION SELECT 1 FROM mutes WHERE account_id = $1 AND target_account_id IN (${placeholders(targetAccountIds, 3)}) UNION SELECT 1 FROM statuses WHERE id = $3 ${req.invertFilters ? 'AND NOT' : 'AND'} tsv @@ (SELECT tsquery_union(websearch_to_tsquery(phrase)) FROM custom_filters WHERE account_id = $1) UNION SELECT 1 FROM media_attachments WHERE (1 = (SELECT 1 FROM accounts WHERE id = $1 AND filter_undescribed)) AND status_id = $3 AND description IS NULL LIMIT 1`, [req.accountId, unpackedPayload.account.id, unpackedPayload.id].concat(targetAccountIds)),
         ];
 
         if (accountDomain) {