main
1# This file is auto-generated from the current state of the database. Instead
2# of editing this file, please use the migrations feature of Active Record to
3# incrementally modify your database, and then regenerate this schema definition.
4#
5# This file is the source Rails uses to define your schema when running `rails
6# db:schema:load`. When creating a new database, `rails db:schema:load` tends to
7# be faster and is potentially less error prone than running all of your
8# migrations from scratch. Old migrations may fail to apply correctly if those
9# migrations use external dependencies or application code.
10#
11# It's strongly recommended that you check this file into your version control system.
12
13ActiveRecord::Schema.define(version: 2019_05_31_042804) do
14
15 # These are extensions that must be enabled in order to support this database
16 enable_extension "pgcrypto"
17 enable_extension "plpgsql"
18 enable_extension "uuid-ossp"
19
20 create_table "audits", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
21 t.string "auditable_id"
22 t.string "auditable_type"
23 t.string "associated_id"
24 t.string "associated_type"
25 t.string "user_id"
26 t.string "user_type"
27 t.string "username"
28 t.string "action"
29 t.text "audited_changes"
30 t.integer "version", default: 0
31 t.string "comment"
32 t.string "remote_address"
33 t.string "request_uuid"
34 t.datetime "created_at"
35 t.index ["associated_type", "associated_id"], name: "index_audits_on_associated_type_and_associated_id"
36 t.index ["auditable_type", "auditable_id", "version"], name: "index_audits_on_auditable_type_and_auditable_id_and_version"
37 t.index ["created_at"], name: "index_audits_on_created_at"
38 t.index ["request_uuid"], name: "index_audits_on_request_uuid"
39 t.index ["user_id", "user_type"], name: "index_audits_on_user_id_and_user_type"
40 end
41
42 create_table "authorizations", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
43 t.uuid "user_id"
44 t.uuid "client_id"
45 t.string "code", null: false
46 t.string "challenge"
47 t.integer "challenge_method", default: 0
48 t.datetime "expired_at", null: false
49 t.datetime "revoked_at"
50 t.datetime "created_at", null: false
51 t.datetime "updated_at", null: false
52 t.index ["client_id"], name: "index_authorizations_on_client_id"
53 t.index ["code"], name: "index_authorizations_on_code"
54 t.index ["user_id"], name: "index_authorizations_on_user_id"
55 end
56
57 create_table "clients", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
58 t.string "name", null: false
59 t.string "password_digest", null: false
60 t.datetime "created_at", null: false
61 t.datetime "updated_at", null: false
62 t.text "redirect_uris", default: [], null: false, array: true
63 t.integer "token_endpoint_auth_method", default: 0, null: false
64 t.string "logo_uri"
65 t.string "jwks_uri"
66 end
67
68 create_table "flipper_features", force: :cascade do |t|
69 t.string "key", null: false
70 t.datetime "created_at", null: false
71 t.datetime "updated_at", null: false
72 t.index ["key"], name: "index_flipper_features_on_key", unique: true
73 end
74
75 create_table "flipper_gates", force: :cascade do |t|
76 t.string "feature_key", null: false
77 t.string "key", null: false
78 t.string "value"
79 t.datetime "created_at", null: false
80 t.datetime "updated_at", null: false
81 t.index ["feature_key", "key", "value"], name: "index_flipper_gates_on_feature_key_and_key_and_value", unique: true
82 end
83
84 create_table "sessions", id: :serial, force: :cascade do |t|
85 t.string "session_id", null: false
86 t.text "data"
87 t.datetime "created_at"
88 t.datetime "updated_at"
89 t.index ["session_id"], name: "index_sessions_on_session_id", unique: true
90 t.index ["updated_at"], name: "index_sessions_on_updated_at"
91 end
92
93 create_table "tokens", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
94 t.bigint "authorization_id"
95 t.string "subject_type"
96 t.uuid "subject_id"
97 t.string "audience_type"
98 t.uuid "audience_id"
99 t.integer "token_type", default: 0
100 t.datetime "expired_at"
101 t.datetime "revoked_at"
102 t.datetime "created_at", null: false
103 t.datetime "updated_at", null: false
104 t.index ["audience_type", "audience_id"], name: "index_tokens_on_audience_type_and_audience_id"
105 t.index ["authorization_id"], name: "index_tokens_on_authorization_id"
106 t.index ["subject_type", "subject_id"], name: "index_tokens_on_subject_type_and_subject_id"
107 end
108
109 create_table "user_sessions", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
110 t.uuid "user_id"
111 t.string "key"
112 t.string "ip"
113 t.text "user_agent"
114 t.datetime "sudo_enabled_at"
115 t.datetime "accessed_at"
116 t.datetime "revoked_at"
117 t.datetime "created_at", null: false
118 t.datetime "updated_at", null: false
119 t.index ["key"], name: "index_user_sessions_on_key", unique: true
120 t.index ["user_id"], name: "index_user_sessions_on_user_id"
121 end
122
123 create_table "users", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
124 t.string "email", null: false
125 t.string "password_digest"
126 t.datetime "created_at", null: false
127 t.datetime "updated_at", null: false
128 t.bigint "lock_version", default: 0, null: false
129 t.string "mfa_secret"
130 t.string "locale", default: "en", null: false
131 t.string "timezone", default: "Etc/UTC", null: false
132 t.index ["email"], name: "index_users_on_email"
133 end
134
135 add_foreign_key "authorizations", "clients"
136 add_foreign_key "authorizations", "users"
137 add_foreign_key "user_sessions", "users"
138end