schema.rb 39.4 KB
Newer Older
Eugen Rochko's avatar
Eugen Rochko committed
1
2
3
4
5
6
7
8
9
10
11
12
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.

ThibG's avatar
ThibG committed
13
ActiveRecord::Schema.define(version: 2019_09_27_232842) do
Eugen Rochko's avatar
Eugen Rochko committed
14

Eugen Rochko's avatar
Eugen Rochko committed
15
16
17
  # These are extensions that must be enabled in order to support this database
  enable_extension "plpgsql"

18
19
20
21
22
23
24
25
26
  create_table "account_aliases", force: :cascade do |t|
    t.bigint "account_id"
    t.string "acct", default: "", null: false
    t.string "uri", default: "", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["account_id"], name: "index_account_aliases_on_account_id"
  end

Eugen Rochko's avatar
Eugen Rochko committed
27
28
29
30
31
32
33
  create_table "account_conversations", force: :cascade do |t|
    t.bigint "account_id"
    t.bigint "conversation_id"
    t.bigint "participant_account_ids", default: [], null: false, array: true
    t.bigint "status_ids", default: [], null: false, array: true
    t.bigint "last_status_id"
    t.integer "lock_version", default: 0, null: false
34
    t.boolean "unread", default: false, null: false
Eugen Rochko's avatar
Eugen Rochko committed
35
36
37
38
39
    t.index ["account_id", "conversation_id", "participant_account_ids"], name: "index_unique_conversations", unique: true
    t.index ["account_id"], name: "index_account_conversations_on_account_id"
    t.index ["conversation_id"], name: "index_account_conversations_on_conversation_id"
  end

40
  create_table "account_domain_blocks", force: :cascade do |t|
41
    t.string "domain"
Eugen Rochko's avatar
Eugen Rochko committed
42
43
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
44
    t.bigint "account_id"
45
    t.index ["account_id", "domain"], name: "index_account_domain_blocks_on_account_id_and_domain", unique: true
Eugen Rochko's avatar
Eugen Rochko committed
46
47
  end

48
49
50
51
52
53
54
55
56
57
58
59
60
  create_table "account_identity_proofs", force: :cascade do |t|
    t.bigint "account_id"
    t.string "provider", default: "", null: false
    t.string "provider_username", default: "", null: false
    t.text "token", default: "", null: false
    t.boolean "verified", default: false, null: false
    t.boolean "live", default: false, null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["account_id", "provider", "provider_username"], name: "index_account_proofs_on_account_and_provider_and_username", unique: true
    t.index ["account_id"], name: "index_account_identity_proofs_on_account_id"
  end

61
62
63
64
65
66
67
68
69
70
71
  create_table "account_migrations", force: :cascade do |t|
    t.bigint "account_id"
    t.string "acct", default: "", null: false
    t.bigint "followers_count", default: 0, null: false
    t.bigint "target_account_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["account_id"], name: "index_account_migrations_on_account_id"
    t.index ["target_account_id"], name: "index_account_migrations_on_target_account_id"
  end

nullkal's avatar
nullkal committed
72
73
  create_table "account_moderation_notes", force: :cascade do |t|
    t.text "content", null: false
74
75
    t.bigint "account_id", null: false
    t.bigint "target_account_id", null: false
nullkal's avatar
nullkal committed
76
77
78
79
80
81
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["account_id"], name: "index_account_moderation_notes_on_account_id"
    t.index ["target_account_id"], name: "index_account_moderation_notes_on_target_account_id"
  end

82
83
84
85
86
87
88
89
90
91
  create_table "account_pins", force: :cascade do |t|
    t.bigint "account_id"
    t.bigint "target_account_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["account_id", "target_account_id"], name: "index_account_pins_on_account_id_and_target_account_id", unique: true
    t.index ["account_id"], name: "index_account_pins_on_account_id"
    t.index ["target_account_id"], name: "index_account_pins_on_target_account_id"
  end

92
93
94
95
96
97
98
  create_table "account_stats", force: :cascade do |t|
    t.bigint "account_id", null: false
    t.bigint "statuses_count", default: 0, null: false
    t.bigint "following_count", default: 0, null: false
    t.bigint "followers_count", default: 0, null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
Eugen Rochko's avatar
Eugen Rochko committed
99
    t.datetime "last_status_at"
100
101
102
    t.index ["account_id"], name: "index_account_stats_on_account_id", unique: true
  end

Eugen Rochko's avatar
Eugen Rochko committed
103
104
105
106
107
108
109
110
111
  create_table "account_tag_stats", force: :cascade do |t|
    t.bigint "tag_id", null: false
    t.bigint "accounts_count", default: 0, null: false
    t.boolean "hidden", default: false, null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["tag_id"], name: "index_account_tag_stats_on_tag_id", unique: true
  end

Eugen Rochko's avatar
Eugen Rochko committed
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
  create_table "account_warning_presets", force: :cascade do |t|
    t.text "text", default: "", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "account_warnings", force: :cascade do |t|
    t.bigint "account_id"
    t.bigint "target_account_id"
    t.integer "action", default: 0, null: false
    t.text "text", default: "", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["account_id"], name: "index_account_warnings_on_account_id"
    t.index ["target_account_id"], name: "index_account_warnings_on_target_account_id"
  end

129
  create_table "accounts", force: :cascade do |t|
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
    t.string "username", default: "", null: false
    t.string "domain"
    t.string "secret", default: "", null: false
    t.text "private_key"
    t.text "public_key", default: "", null: false
    t.string "remote_url", default: "", null: false
    t.string "salmon_url", default: "", null: false
    t.string "hub_url", default: "", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.text "note", default: "", null: false
    t.string "display_name", default: "", null: false
    t.string "uri", default: "", null: false
    t.string "url"
    t.string "avatar_file_name"
    t.string "avatar_content_type"
    t.integer "avatar_file_size"
147
    t.datetime "avatar_updated_at"
148
149
150
    t.string "header_file_name"
    t.string "header_content_type"
    t.integer "header_file_size"
151
    t.datetime "header_updated_at"
152
    t.string "avatar_remote_url"
153
    t.datetime "subscription_expires_at"
154
155
    t.boolean "locked", default: false, null: false
    t.string "header_remote_url", default: "", null: false
Eugen's avatar
Eugen committed
156
    t.datetime "last_webfingered_at"
157
158
159
160
161
    t.string "inbox_url", default: "", null: false
    t.string "outbox_url", default: "", null: false
    t.string "shared_inbox_url", default: "", null: false
    t.string "followers_url", default: "", null: false
    t.integer "protocol", default: 0, null: false
162
    t.boolean "memorial", default: false, null: false
Eugen Rochko's avatar
Eugen Rochko committed
163
    t.bigint "moved_to_account_id"
164
    t.string "featured_collection_url"
Eugen Rochko's avatar
Eugen Rochko committed
165
    t.jsonb "fields"
Eugen Rochko's avatar
Eugen Rochko committed
166
    t.string "actor_type"
Eugen Rochko's avatar
Eugen Rochko committed
167
    t.boolean "discoverable"
168
    t.string "also_known_as", array: true
169
170
    t.datetime "silenced_at"
    t.datetime "suspended_at"
Eugen Rochko's avatar
Eugen Rochko committed
171
    t.integer "trust_level"
172
    t.index "(((setweight(to_tsvector('simple'::regconfig, (display_name)::text), 'A'::\"char\") || setweight(to_tsvector('simple'::regconfig, (username)::text), 'B'::\"char\")) || setweight(to_tsvector('simple'::regconfig, (COALESCE(domain, ''::character varying))::text), 'C'::\"char\")))", name: "search_index", using: :gin
173
    t.index "lower((username)::text), lower((domain)::text)", name: "index_accounts_on_username_and_domain_lower", unique: true
174
    t.index ["moved_to_account_id"], name: "index_accounts_on_moved_to_account_id"
175
176
    t.index ["uri"], name: "index_accounts_on_uri"
    t.index ["url"], name: "index_accounts_on_url"
Eugen Rochko's avatar
Eugen Rochko committed
177
178
  end

Eugen Rochko's avatar
Eugen Rochko committed
179
180
181
182
183
184
185
  create_table "accounts_tags", id: false, force: :cascade do |t|
    t.bigint "account_id", null: false
    t.bigint "tag_id", null: false
    t.index ["account_id", "tag_id"], name: "index_accounts_tags_on_account_id_and_tag_id"
    t.index ["tag_id", "account_id"], name: "index_accounts_tags_on_tag_id_and_account_id", unique: true
  end

186
187
188
189
190
191
192
193
194
195
196
197
  create_table "admin_action_logs", force: :cascade do |t|
    t.bigint "account_id"
    t.string "action", default: "", null: false
    t.string "target_type"
    t.bigint "target_id"
    t.text "recorded_changes", default: "", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["account_id"], name: "index_admin_action_logs_on_account_id"
    t.index ["target_type", "target_id"], name: "index_admin_action_logs_on_target_type_and_target_id"
  end

198
199
200
201
202
203
204
205
206
207
208
  create_table "backups", force: :cascade do |t|
    t.bigint "user_id"
    t.string "dump_file_name"
    t.string "dump_content_type"
    t.integer "dump_file_size"
    t.datetime "dump_updated_at"
    t.boolean "processed", default: false, null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

209
  create_table "blocks", force: :cascade do |t|
210
211
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
212
213
    t.bigint "account_id", null: false
    t.bigint "target_account_id", null: false
214
    t.string "uri"
215
    t.index ["account_id", "target_account_id"], name: "index_blocks_on_account_id_and_target_account_id", unique: true
216
    t.index ["target_account_id"], name: "index_blocks_on_target_account_id"
217
218
  end

219
  create_table "conversation_mutes", force: :cascade do |t|
220
    t.bigint "conversation_id", null: false
221
    t.bigint "account_id", null: false
222
    t.index ["account_id", "conversation_id"], name: "index_conversation_mutes_on_account_id_and_conversation_id", unique: true
223
224
  end

225
  create_table "conversations", force: :cascade do |t|
226
    t.string "uri"
227
228
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
229
    t.index ["uri"], name: "index_conversations_on_uri", unique: true
230
231
  end

232
233
234
235
236
237
238
  create_table "custom_emoji_categories", force: :cascade do |t|
    t.string "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["name"], name: "index_custom_emoji_categories_on_name", unique: true
  end

Eugen Rochko's avatar
Eugen Rochko committed
239
240
241
242
243
244
245
246
247
  create_table "custom_emojis", force: :cascade do |t|
    t.string "shortcode", default: "", null: false
    t.string "domain"
    t.string "image_file_name"
    t.string "image_content_type"
    t.integer "image_file_size"
    t.datetime "image_updated_at"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
248
    t.boolean "disabled", default: false, null: false
249
250
    t.string "uri"
    t.string "image_remote_url"
251
    t.boolean "visible_in_picker", default: true, null: false
252
    t.bigint "category_id"
Eugen Rochko's avatar
Eugen Rochko committed
253
254
255
    t.index ["shortcode", "domain"], name: "index_custom_emojis_on_shortcode_and_domain", unique: true
  end

256
257
258
259
260
261
262
263
  create_table "custom_filters", force: :cascade do |t|
    t.bigint "account_id"
    t.datetime "expires_at"
    t.text "phrase", default: "", null: false
    t.string "context", default: [], null: false, array: true
    t.boolean "irreversible", default: false, null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
264
    t.boolean "whole_word", default: true, null: false
265
266
267
    t.index ["account_id"], name: "index_custom_filters_on_account_id"
  end

Eugen Rochko's avatar
Eugen Rochko committed
268
269
270
271
272
273
274
  create_table "domain_allows", force: :cascade do |t|
    t.string "domain", default: "", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["domain"], name: "index_domain_allows_on_domain", unique: true
  end

275
  create_table "domain_blocks", force: :cascade do |t|
276
277
278
279
    t.string "domain", default: "", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "severity", default: 0
280
    t.boolean "reject_media", default: false, null: false
281
    t.boolean "reject_reports", default: false, null: false
ThibG's avatar
ThibG committed
282
283
    t.text "private_comment"
    t.text "public_comment"
284
    t.index ["domain"], name: "index_domain_blocks_on_domain", unique: true
Eugen Rochko's avatar
Eugen Rochko committed
285
286
  end

utam0k's avatar
utam0k committed
287
  create_table "email_domain_blocks", force: :cascade do |t|
288
    t.string "domain", default: "", null: false
utam0k's avatar
utam0k committed
289
290
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
291
    t.index ["domain"], name: "index_email_domain_blocks_on_domain", unique: true
utam0k's avatar
utam0k committed
292
293
  end

294
  create_table "favourites", force: :cascade do |t|
295
296
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
297
298
    t.bigint "account_id", null: false
    t.bigint "status_id", null: false
299
    t.index ["account_id", "id"], name: "index_favourites_on_account_id_and_id"
300
301
    t.index ["account_id", "status_id"], name: "index_favourites_on_account_id_and_status_id", unique: true
    t.index ["status_id"], name: "index_favourites_on_status_id"
302
303
  end

304
305
306
307
308
309
310
311
312
313
314
  create_table "featured_tags", force: :cascade do |t|
    t.bigint "account_id"
    t.bigint "tag_id"
    t.bigint "statuses_count", default: 0, null: false
    t.datetime "last_status_at"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["account_id"], name: "index_featured_tags_on_account_id"
    t.index ["tag_id"], name: "index_featured_tags_on_tag_id"
  end

315
  create_table "follow_requests", force: :cascade do |t|
316
317
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
318
319
    t.bigint "account_id", null: false
    t.bigint "target_account_id", null: false
320
    t.boolean "show_reblogs", default: true, null: false
321
    t.string "uri"
322
    t.index ["account_id", "target_account_id"], name: "index_follow_requests_on_account_id_and_target_account_id", unique: true
323
324
  end

325
  create_table "follows", force: :cascade do |t|
326
327
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
328
329
    t.bigint "account_id", null: false
    t.bigint "target_account_id", null: false
330
    t.boolean "show_reblogs", default: true, null: false
331
    t.string "uri"
332
    t.index ["account_id", "target_account_id"], name: "index_follows_on_account_id_and_target_account_id", unique: true
333
    t.index ["target_account_id"], name: "index_follows_on_target_account_id"
Eugen Rochko's avatar
Eugen Rochko committed
334
335
  end

336
  create_table "identities", force: :cascade do |t|
337
338
339
340
    t.string "provider", default: "", null: false
    t.string "uid", default: "", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
341
    t.bigint "user_id"
342
343
344
    t.index ["user_id"], name: "index_identities_on_user_id"
  end

345
  create_table "imports", force: :cascade do |t|
346
    t.integer "type", null: false
347
    t.boolean "approved", default: false, null: false
348
349
350
351
352
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "data_file_name"
    t.string "data_content_type"
    t.integer "data_file_size"
353
    t.datetime "data_updated_at"
354
    t.bigint "account_id", null: false
355
    t.boolean "overwrite", default: false, null: false
356
357
  end

Eugen Rochko's avatar
Eugen Rochko committed
358
  create_table "invites", force: :cascade do |t|
359
    t.bigint "user_id", null: false
Eugen Rochko's avatar
Eugen Rochko committed
360
361
362
363
364
365
    t.string "code", default: "", null: false
    t.datetime "expires_at"
    t.integer "max_uses"
    t.integer "uses", default: 0, null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
366
    t.boolean "autofollow", default: false, null: false
ThibG's avatar
ThibG committed
367
    t.text "comment"
Eugen Rochko's avatar
Eugen Rochko committed
368
369
370
371
    t.index ["code"], name: "index_invites_on_code", unique: true
    t.index ["user_id"], name: "index_invites_on_user_id"
  end

Eugen Rochko's avatar
Eugen Rochko committed
372
373
374
375
376
377
378
379
380
381
  create_table "list_accounts", force: :cascade do |t|
    t.bigint "list_id", null: false
    t.bigint "account_id", null: false
    t.bigint "follow_id", null: false
    t.index ["account_id", "list_id"], name: "index_list_accounts_on_account_id_and_list_id", unique: true
    t.index ["follow_id"], name: "index_list_accounts_on_follow_id"
    t.index ["list_id", "account_id"], name: "index_list_accounts_on_list_id_and_account_id"
  end

  create_table "lists", force: :cascade do |t|
382
    t.bigint "account_id", null: false
Eugen Rochko's avatar
Eugen Rochko committed
383
384
385
386
387
388
    t.string "title", default: "", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["account_id"], name: "index_lists_on_account_id"
  end

389
390
391
392
393
394
395
396
397
398
399
  create_table "markers", force: :cascade do |t|
    t.bigint "user_id"
    t.string "timeline", default: "", null: false
    t.bigint "last_read_id", default: 0, null: false
    t.integer "lock_version", default: 0, null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id", "timeline"], name: "index_markers_on_user_id_and_timeline", unique: true
    t.index ["user_id"], name: "index_markers_on_user_id"
  end

400
  create_table "media_attachments", force: :cascade do |t|
401
402
403
404
    t.bigint "status_id"
    t.string "file_file_name"
    t.string "file_content_type"
    t.integer "file_file_size"
405
    t.datetime "file_updated_at"
406
407
408
409
410
411
    t.string "remote_url", default: "", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "shortcode"
    t.integer "type", default: 0, null: false
    t.json "file_meta"
412
    t.bigint "account_id"
413
    t.text "description"
Eugen Rochko's avatar
Eugen Rochko committed
414
    t.bigint "scheduled_status_id"
Eugen Rochko's avatar
Eugen Rochko committed
415
    t.string "blurhash"
416
    t.index ["account_id"], name: "index_media_attachments_on_account_id"
Eugen Rochko's avatar
Eugen Rochko committed
417
    t.index ["scheduled_status_id"], name: "index_media_attachments_on_scheduled_status_id"
418
419
    t.index ["shortcode"], name: "index_media_attachments_on_shortcode", unique: true
    t.index ["status_id"], name: "index_media_attachments_on_status_id"
420
421
  end

422
  create_table "mentions", force: :cascade do |t|
423
    t.bigint "status_id"
424
425
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
426
    t.bigint "account_id"
427
    t.boolean "silent", default: false, null: false
428
429
    t.index ["account_id", "status_id"], name: "index_mentions_on_account_id_and_status_id", unique: true
    t.index ["status_id"], name: "index_mentions_on_status_id"
430
431
  end

432
  create_table "mutes", force: :cascade do |t|
433
434
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
435
    t.boolean "hide_notifications", default: true, null: false
436
437
    t.bigint "account_id", null: false
    t.bigint "target_account_id", null: false
438
    t.index ["account_id", "target_account_id"], name: "index_mutes_on_account_id_and_target_account_id", unique: true
439
    t.index ["target_account_id"], name: "index_mutes_on_target_account_id"
440
441
  end

442
  create_table "notifications", force: :cascade do |t|
443
444
    t.bigint "activity_id", null: false
    t.string "activity_type", null: false
445
446
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
447
448
    t.bigint "account_id", null: false
    t.bigint "from_account_id", null: false
449
    t.index ["account_id", "activity_id", "activity_type"], name: "account_activity", unique: true
450
    t.index ["account_id", "id"], name: "index_notifications_on_account_id_and_id", order: { id: :desc }
451
    t.index ["activity_id", "activity_type"], name: "index_notifications_on_activity_id_and_activity_type"
452
    t.index ["from_account_id"], name: "index_notifications_on_from_account_id"
453
454
  end

455
  create_table "oauth_access_grants", force: :cascade do |t|
456
457
458
459
    t.string "token", null: false
    t.integer "expires_in", null: false
    t.text "redirect_uri", null: false
    t.datetime "created_at", null: false
460
    t.datetime "revoked_at"
461
    t.string "scopes"
462
463
    t.bigint "application_id", null: false
    t.bigint "resource_owner_id", null: false
464
    t.index ["resource_owner_id"], name: "index_oauth_access_grants_on_resource_owner_id"
465
    t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true
466
467
  end

468
  create_table "oauth_access_tokens", force: :cascade do |t|
469
470
471
    t.string "token", null: false
    t.string "refresh_token"
    t.integer "expires_in"
472
    t.datetime "revoked_at"
473
474
    t.datetime "created_at", null: false
    t.string "scopes"
475
476
    t.bigint "application_id"
    t.bigint "resource_owner_id"
477
478
479
    t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true
    t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id"
    t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true
480
481
  end

482
  create_table "oauth_applications", force: :cascade do |t|
483
484
485
486
487
    t.string "name", null: false
    t.string "uid", null: false
    t.string "secret", null: false
    t.text "redirect_uri", null: false
    t.string "scopes", default: "", null: false
488
489
    t.datetime "created_at"
    t.datetime "updated_at"
490
491
492
    t.boolean "superapp", default: false, null: false
    t.string "website"
    t.string "owner_type"
493
    t.bigint "owner_id"
494
    t.boolean "confidential", default: true, null: false
495
    t.index ["owner_id", "owner_type"], name: "index_oauth_applications_on_owner_id_and_owner_type"
496
    t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true
497
498
  end

499
500
501
502
503
504
505
506
507
  create_table "pghero_space_stats", force: :cascade do |t|
    t.text "database"
    t.text "schema"
    t.text "relation"
    t.bigint "size"
    t.datetime "captured_at"
    t.index ["database", "captured_at"], name: "index_pghero_space_stats_on_database_and_captured_at"
  end

Eugen Rochko's avatar
Eugen Rochko committed
508
509
510
511
512
513
  create_table "poll_votes", force: :cascade do |t|
    t.bigint "account_id"
    t.bigint "poll_id"
    t.integer "choice", default: 0, null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
ThibG's avatar
ThibG committed
514
    t.string "uri"
Eugen Rochko's avatar
Eugen Rochko committed
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
    t.index ["account_id"], name: "index_poll_votes_on_account_id"
    t.index ["poll_id"], name: "index_poll_votes_on_poll_id"
  end

  create_table "polls", force: :cascade do |t|
    t.bigint "account_id"
    t.bigint "status_id"
    t.datetime "expires_at"
    t.string "options", default: [], null: false, array: true
    t.bigint "cached_tallies", default: [], null: false, array: true
    t.boolean "multiple", default: false, null: false
    t.boolean "hide_totals", default: false, null: false
    t.bigint "votes_count", default: 0, null: false
    t.datetime "last_fetched_at"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
531
    t.integer "lock_version", default: 0, null: false
ThibG's avatar
ThibG committed
532
    t.bigint "voters_count"
Eugen Rochko's avatar
Eugen Rochko committed
533
534
535
536
    t.index ["account_id"], name: "index_polls_on_account_id"
    t.index ["status_id"], name: "index_polls_on_status_id"
  end

537
  create_table "preview_cards", force: :cascade do |t|
538
    t.string "url", default: "", null: false
539
540
    t.string "title", default: "", null: false
    t.string "description", default: "", null: false
541
542
543
    t.string "image_file_name"
    t.string "image_content_type"
    t.integer "image_file_size"
544
    t.datetime "image_updated_at"
545
546
547
548
549
550
551
552
    t.integer "type", default: 0, null: false
    t.text "html", default: "", null: false
    t.string "author_name", default: "", null: false
    t.string "author_url", default: "", null: false
    t.string "provider_name", default: "", null: false
    t.string "provider_url", default: "", null: false
    t.integer "width", default: 0, null: false
    t.integer "height", default: 0, null: false
553
554
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
555
    t.string "embed_url", default: "", null: false
556
557
558
559
560
561
562
    t.index ["url"], name: "index_preview_cards_on_url", unique: true
  end

  create_table "preview_cards_statuses", id: false, force: :cascade do |t|
    t.bigint "preview_card_id", null: false
    t.bigint "status_id", null: false
    t.index ["status_id", "preview_card_id"], name: "index_preview_cards_statuses_on_status_id_and_preview_card_id"
563
564
  end

565
566
567
568
569
  create_table "relays", force: :cascade do |t|
    t.string "inbox_url", default: "", null: false
    t.string "follow_activity_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
570
    t.integer "state", default: 0, null: false
571
572
  end

573
574
575
576
577
578
579
580
581
582
  create_table "report_notes", force: :cascade do |t|
    t.text "content", null: false
    t.bigint "report_id", null: false
    t.bigint "account_id", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["account_id"], name: "index_report_notes_on_account_id"
    t.index ["report_id"], name: "index_report_notes_on_report_id"
  end

583
  create_table "reports", force: :cascade do |t|
584
585
586
587
588
    t.bigint "status_ids", default: [], null: false, array: true
    t.text "comment", default: "", null: false
    t.boolean "action_taken", default: false, null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
589
    t.bigint "account_id", null: false
590
    t.bigint "action_taken_by_account_id"
591
    t.bigint "target_account_id", null: false
592
    t.bigint "assigned_account_id"
ThibG's avatar
ThibG committed
593
    t.string "uri"
594
595
    t.index ["account_id"], name: "index_reports_on_account_id"
    t.index ["target_account_id"], name: "index_reports_on_target_account_id"
596
597
  end

Eugen Rochko's avatar
Eugen Rochko committed
598
599
600
601
602
603
604
605
  create_table "scheduled_statuses", force: :cascade do |t|
    t.bigint "account_id"
    t.datetime "scheduled_at"
    t.jsonb "params"
    t.index ["account_id"], name: "index_scheduled_statuses_on_account_id"
    t.index ["scheduled_at"], name: "index_scheduled_statuses_on_scheduled_at"
  end

Sorin Davidoi's avatar
Sorin Davidoi committed
606
607
608
609
  create_table "session_activations", force: :cascade do |t|
    t.string "session_id", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
610
611
    t.string "user_agent", default: "", null: false
    t.inet "ip"
612
    t.bigint "access_token_id"
613
    t.bigint "user_id", null: false
614
    t.bigint "web_push_subscription_id"
615
    t.index ["access_token_id"], name: "index_session_activations_on_access_token_id"
Sorin Davidoi's avatar
Sorin Davidoi committed
616
617
618
619
    t.index ["session_id"], name: "index_session_activations_on_session_id", unique: true
    t.index ["user_id"], name: "index_session_activations_on_user_id"
  end

620
  create_table "settings", force: :cascade do |t|
621
622
623
    t.string "var", null: false
    t.text "value"
    t.string "thing_type"
624
625
    t.datetime "created_at"
    t.datetime "updated_at"
626
    t.bigint "thing_id"
627
    t.index ["thing_type", "thing_id", "var"], name: "index_settings_on_thing_type_and_thing_id_and_var", unique: true
628
629
  end

630
631
632
633
634
635
636
637
638
639
640
641
  create_table "site_uploads", force: :cascade do |t|
    t.string "var", default: "", null: false
    t.string "file_file_name"
    t.string "file_content_type"
    t.integer "file_file_size"
    t.datetime "file_updated_at"
    t.json "meta"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["var"], name: "index_site_uploads_on_var", unique: true
  end

Eugen Rochko's avatar
Eugen Rochko committed
642
643
644
  create_table "status_pins", force: :cascade do |t|
    t.bigint "account_id", null: false
    t.bigint "status_id", null: false
645
646
    t.datetime "created_at", default: -> { "now()" }, null: false
    t.datetime "updated_at", default: -> { "now()" }, null: false
Eugen Rochko's avatar
Eugen Rochko committed
647
648
649
    t.index ["account_id", "status_id"], name: "index_status_pins_on_account_id_and_status_id", unique: true
  end

650
651
652
653
654
655
656
657
658
659
  create_table "status_stats", force: :cascade do |t|
    t.bigint "status_id", null: false
    t.bigint "replies_count", default: 0, null: false
    t.bigint "reblogs_count", default: 0, null: false
    t.bigint "favourites_count", default: 0, null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["status_id"], name: "index_status_stats_on_status_id", unique: true
  end

660
  create_table "statuses", id: :bigint, default: -> { "timestamp_id('statuses'::text)" }, force: :cascade do |t|
661
662
663
664
665
666
667
    t.string "uri"
    t.text "text", default: "", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.bigint "in_reply_to_id"
    t.bigint "reblog_of_id"
    t.string "url"
668
    t.boolean "sensitive", default: false, null: false
669
670
    t.integer "visibility", default: 0, null: false
    t.text "spoiler_text", default: "", null: false
671
    t.boolean "reply", default: false, null: false
672
    t.string "language"
673
    t.bigint "conversation_id"
674
    t.boolean "local"
675
676
677
    t.bigint "account_id", null: false
    t.bigint "application_id"
    t.bigint "in_reply_to_account_id"
Eugen Rochko's avatar
Eugen Rochko committed
678
    t.bigint "poll_id"
679
680
    t.datetime "deleted_at"
    t.index ["account_id", "id", "visibility", "updated_at"], name: "index_statuses_20190820", order: { id: :desc }, where: "(deleted_at IS NULL)"
681
    t.index ["id", "account_id"], name: "index_statuses_local_20190824", order: { id: :desc }, where: "((local OR (uri IS NULL)) AND (deleted_at IS NULL) AND (visibility = 0) AND (reblog_of_id IS NULL) AND ((NOT reply) OR (in_reply_to_account_id = account_id)))"
682
    t.index ["in_reply_to_account_id"], name: "index_statuses_on_in_reply_to_account_id"
683
    t.index ["in_reply_to_id"], name: "index_statuses_on_in_reply_to_id"
684
    t.index ["reblog_of_id", "account_id"], name: "index_statuses_on_reblog_of_id_and_account_id"
685
    t.index ["uri"], name: "index_statuses_on_uri", unique: true
Eugen Rochko's avatar
Eugen Rochko committed
686
687
688
  end

  create_table "statuses_tags", id: false, force: :cascade do |t|
689
    t.bigint "status_id", null: false
690
    t.bigint "tag_id", null: false
691
692
    t.index ["status_id"], name: "index_statuses_tags_on_status_id"
    t.index ["tag_id", "status_id"], name: "index_statuses_tags_on_tag_id_and_status_id", unique: true
Eugen Rochko's avatar
Eugen Rochko committed
693
694
  end

695
  create_table "tags", force: :cascade do |t|
696
697
698
    t.string "name", default: "", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
699
700
701
702
703
    t.boolean "usable"
    t.boolean "trendable"
    t.boolean "listable"
    t.datetime "reviewed_at"
    t.datetime "requested_review_at"
704
    t.datetime "last_status_at"
705
706
    t.float "max_score"
    t.datetime "max_score_at"
707
    t.index "lower((name)::text)", name: "index_tags_on_name_lower", unique: true
Eugen Rochko's avatar
Eugen Rochko committed
708
709
  end

710
711
712
713
714
  create_table "tombstones", force: :cascade do |t|
    t.bigint "account_id"
    t.string "uri", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
715
    t.boolean "by_moderator"
716
717
718
719
    t.index ["account_id"], name: "index_tombstones_on_account_id"
    t.index ["uri"], name: "index_tombstones_on_uri"
  end

720
721
722
723
724
725
726
727
  create_table "user_invite_requests", force: :cascade do |t|
    t.bigint "user_id"
    t.text "text"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id"], name: "index_user_invite_requests_on_user_id"
  end

728
  create_table "users", force: :cascade do |t|
729
730
731
732
733
    t.string "email", default: "", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "encrypted_password", default: "", null: false
    t.string "reset_password_token"
734
735
    t.datetime "reset_password_sent_at"
    t.datetime "remember_created_at"
736
    t.integer "sign_in_count", default: 0, null: false
737
738
    t.datetime "current_sign_in_at"
    t.datetime "last_sign_in_at"
739
740
    t.inet "current_sign_in_ip"
    t.inet "last_sign_in_ip"
741
    t.boolean "admin", default: false, null: false
742
    t.string "confirmation_token"
Eugen Rochko's avatar
Eugen Rochko committed
743
744
    t.datetime "confirmed_at"
    t.datetime "confirmation_sent_at"
745
746
747
748
749
750
    t.string "unconfirmed_email"
    t.string "locale"
    t.string "encrypted_otp_secret"
    t.string "encrypted_otp_secret_iv"
    t.string "encrypted_otp_secret_salt"
    t.integer "consumed_timestep"
751
    t.boolean "otp_required_for_login", default: false, null: false
Eugen Rochko's avatar
Eugen Rochko committed
752
    t.datetime "last_emailed_at"
753
754
    t.string "otp_backup_codes", array: true
    t.string "filtered_languages", default: [], null: false, array: true
755
    t.bigint "account_id", null: false
756
    t.boolean "disabled", default: false, null: false
757
    t.boolean "moderator", default: false, null: false
Eugen Rochko's avatar
Eugen Rochko committed
758
    t.bigint "invite_id"
Alexander's avatar
Alexander committed
759
    t.string "remember_token"
760
    t.string "chosen_languages", array: true
761
    t.bigint "created_by_application_id"
762
    t.boolean "approved", default: true, null: false
763
764
    t.index ["account_id"], name: "index_users_on_account_id"
    t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
765
    t.index ["created_by_application_id"], name: "index_users_on_created_by_application_id"
766
    t.index ["email"], name: "index_users_on_email", unique: true
767
    t.index ["remember_token"], name: "index_users_on_remember_token", unique: true
768
    t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
Eugen Rochko's avatar
Eugen Rochko committed
769
770
  end

Sorin Davidoi's avatar
Sorin Davidoi committed
771
772
773
774
775
776
777
  create_table "web_push_subscriptions", force: :cascade do |t|
    t.string "endpoint", null: false
    t.string "key_p256dh", null: false
    t.string "key_auth", null: false
    t.json "data"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
778
779
780
781
    t.bigint "access_token_id"
    t.bigint "user_id"
    t.index ["access_token_id"], name: "index_web_push_subscriptions_on_access_token_id"
    t.index ["user_id"], name: "index_web_push_subscriptions_on_user_id"
Sorin Davidoi's avatar
Sorin Davidoi committed
782
783
  end

784
  create_table "web_settings", force: :cascade do |t|
785
    t.json "data"
786
787
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
788
    t.bigint "user_id", null: false
789
    t.index ["user_id"], name: "index_web_settings_on_user_id", unique: true
790
791
  end

792
  add_foreign_key "account_aliases", "accounts", on_delete: :cascade
Eugen Rochko's avatar
Eugen Rochko committed
793
794
  add_foreign_key "account_conversations", "accounts", on_delete: :cascade
  add_foreign_key "account_conversations", "conversations", on_delete: :cascade
795
  add_foreign_key "account_domain_blocks", "accounts", name: "fk_206c6029bd", on_delete: :cascade
796
  add_foreign_key "account_identity_proofs", "accounts", on_delete: :cascade
797
798
  add_foreign_key "account_migrations", "accounts", column: "target_account_id", on_delete: :nullify
  add_foreign_key "account_migrations", "accounts", on_delete: :cascade
799
  add_foreign_key "account_moderation_notes", "accounts"
nullkal's avatar
nullkal committed
800
  add_foreign_key "account_moderation_notes", "accounts", column: "target_account_id"
801
802
  add_foreign_key "account_pins", "accounts", column: "target_account_id", on_delete: :cascade
  add_foreign_key "account_pins", "accounts", on_delete: :cascade
803
  add_foreign_key "account_stats", "accounts", on_delete: :cascade
Eugen Rochko's avatar
Eugen Rochko committed
804
  add_foreign_key "account_tag_stats", "tags", on_delete: :cascade
Eugen Rochko's avatar
Eugen Rochko committed
805
806
  add_foreign_key "account_warnings", "accounts", column: "target_account_id", on_delete: :cascade
  add_foreign_key "account_warnings", "accounts", on_delete: :nullify
Eugen Rochko's avatar
Eugen Rochko committed
807
  add_foreign_key "accounts", "accounts", column: "moved_to_account_id", on_delete: :nullify
808
  add_foreign_key "admin_action_logs", "accounts", on_delete: :cascade
Eugen Rochko's avatar
Eugen Rochko committed
809
  add_foreign_key "backups", "users", on_delete: :nullify
810
811
812
  add_foreign_key "blocks", "accounts", column: "target_account_id", name: "fk_9571bfabc1", on_delete: :cascade
  add_foreign_key "blocks", "accounts", name: "fk_4269e03e65", on_delete: :cascade
  add_foreign_key "conversation_mutes", "accounts", name: "fk_225b4212bb", on_delete: :cascade
813
  add_foreign_key "conversation_mutes", "conversations", on_delete: :cascade
814
  add_foreign_key "custom_filters", "accounts", on_delete: :cascade
815
816
  add_foreign_key "favourites", "accounts", name: "fk_5eb6c2b873", on_delete: :cascade
  add_foreign_key "favourites", "statuses", name: "fk_b0e856845e", on_delete: :cascade
817
818
  add_foreign_key "featured_tags", "accounts", on_delete: :cascade
  add_foreign_key "featured_tags", "tags", on_delete: :cascade
819
820
821
822
  add_foreign_key "follow_requests", "accounts", column: "target_account_id", name: "fk_9291ec025d", on_delete: :cascade
  add_foreign_key "follow_requests", "accounts", name: "fk_76d644b0e7", on_delete: :cascade
  add_foreign_key "follows", "accounts", column: "target_account_id", name: "fk_745ca29eac", on_delete: :cascade
  add_foreign_key "follows", "accounts", name: "fk_32ed1b5560", on_delete: :cascade
823
  add_foreign_key "identities", "users", name: "fk_bea040f377", on_delete: :cascade
824
  add_foreign_key "imports", "accounts", name: "fk_6db1b6e408", on_delete: :cascade
Eugen Rochko's avatar
Eugen Rochko committed
825
  add_foreign_key "invites", "users", on_delete: :cascade
Eugen Rochko's avatar
Eugen Rochko committed
826
827
828
829
  add_foreign_key "list_accounts", "accounts", on_delete: :cascade
  add_foreign_key "list_accounts", "follows", on_delete: :cascade
  add_foreign_key "list_accounts", "lists", on_delete: :cascade
  add_foreign_key "lists", "accounts", on_delete: :cascade
830
  add_foreign_key "markers", "users", on_delete: :cascade
831
  add_foreign_key "media_attachments", "accounts", name: "fk_96dd81e81b", on_delete: :nullify
Eugen Rochko's avatar
Eugen Rochko committed
832
  add_foreign_key "media_attachments", "scheduled_statuses", on_delete: :nullify
833
  add_foreign_key "media_attachments", "statuses", on_delete: :nullify
834
  add_foreign_key "mentions", "accounts", name: "fk_970d43f9d1", on_delete: :cascade
835
  add_foreign_key "mentions", "statuses", on_delete: :cascade
836
837
838
839
840
841
842
843
844
  add_foreign_key "mutes", "accounts", column: "target_account_id", name: "fk_eecff219ea", on_delete: :cascade
  add_foreign_key "mutes", "accounts", name: "fk_b8d8daf315", on_delete: :cascade
  add_foreign_key "notifications", "accounts", column: "from_account_id", name: "fk_fbd6b0bf9e", on_delete: :cascade
  add_foreign_key "notifications", "accounts", name: "fk_c141c8ee55", on_delete: :cascade
  add_foreign_key "oauth_access_grants", "oauth_applications", column: "application_id", name: "fk_34d54b0a33", on_delete: :cascade
  add_foreign_key "oauth_access_grants", "users", column: "resource_owner_id", name: "fk_63b044929b", on_delete: :cascade
  add_foreign_key "oauth_access_tokens", "oauth_applications", column: "application_id", name: "fk_f5fc4c1ee3", on_delete: :cascade
  add_foreign_key "oauth_access_tokens", "users", column: "resource_owner_id", name: "fk_e84df68546", on_delete: :cascade
  add_foreign_key "oauth_applications", "users", column: "owner_id", name: "fk_b0988c7c0a", on_delete: :cascade
Eugen Rochko's avatar
Eugen Rochko committed
845
846
847
848
  add_foreign_key "poll_votes", "accounts", on_delete: :cascade
  add_foreign_key "poll_votes", "polls", on_delete: :cascade
  add_foreign_key "polls", "accounts", on_delete: :cascade
  add_foreign_key "polls", "statuses", on_delete: :cascade
849
850
  add_foreign_key "report_notes", "accounts", on_delete: :cascade
  add_foreign_key "report_notes", "reports", on_delete: :cascade
851
  add_foreign_key "reports", "accounts", column: "action_taken_by_account_id", name: "fk_bca45b75fd", on_delete: :nullify
852
  add_foreign_key "reports", "accounts", column: "assigned_account_id", on_delete: :nullify
853
854
  add_foreign_key "reports", "accounts", column: "target_account_id", name: "fk_eb37af34f0", on_delete: :cascade
  add_foreign_key "reports", "accounts", name: "fk_4b81f7522c", on_delete: :cascade
Eugen Rochko's avatar
Eugen Rochko committed
855
  add_foreign_key "scheduled_statuses", "accounts", on_delete: :cascade
856
857
858
  add_foreign_key "session_activations", "oauth_access_tokens", column: "access_token_id", name: "fk_957e5bda89", on_delete: :cascade
  add_foreign_key "session_activations", "users", name: "fk_e5fda67334", on_delete: :cascade
  add_foreign_key "status_pins", "accounts", name: "fk_d4cb435b62", on_delete: :cascade
Eugen Rochko's avatar
Eugen Rochko committed
859
  add_foreign_key "status_pins", "statuses", on_delete: :cascade
860
  add_foreign_key "status_stats", "statuses", on_delete: :cascade
861
862
  add_foreign_key "statuses", "accounts", column: "in_reply_to_account_id", name: "fk_c7fa917661", on_delete: :nullify
  add_foreign_key "statuses", "accounts", name: "fk_9bda1543f7", on_delete: :cascade
863
  add_foreign_key "statuses", "statuses", column: "in_reply_to_id", on_delete: :nullify
864
  add_foreign_key "statuses", "statuses", column: "reblog_of_id", on_delete: :cascade
865
  add_foreign_key "statuses_tags", "statuses", on_delete: :cascade
866
  add_foreign_key "statuses_tags", "tags", name: "fk_3081861e21", on_delete: :cascade
867
  add_foreign_key "tombstones", "accounts", on_delete: :cascade
868
  add_foreign_key "user_invite_requests", "users", on_delete: :cascade
869
  add_foreign_key "users", "accounts", name: "fk_50500f500d", on_delete: :cascade
Eugen Rochko's avatar
Eugen Rochko committed
870
  add_foreign_key "users", "invites", on_delete: :nullify
871
  add_foreign_key "users", "oauth_applications", column: "created_by_application_id", on_delete: :nullify
872
873
  add_foreign_key "web_push_subscriptions", "oauth_access_tokens", column: "access_token_id", on_delete: :cascade
  add_foreign_key "web_push_subscriptions", "users", on_delete: :cascade
874
  add_foreign_key "web_settings", "users", name: "fk_11910667b2", on_delete: :cascade
875
end