2024-05-03 03:04:43 +00:00
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
# This file is the source Rails uses to define your schema when running `bin/rails
|
|
|
|
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
|
|
|
# be faster and is potentially less error prone than running all of your
|
|
|
|
# migrations from scratch. Old migrations may fail to apply correctly if those
|
|
|
|
# migrations use external dependencies or application code.
|
|
|
|
#
|
|
|
|
# It's strongly recommended that you check this file into your version control system.
|
|
|
|
|
2024-05-06 07:47:53 +00:00
|
|
|
ActiveRecord::Schema[7.1].define(version: 2024_05_04_225048) do
|
2024-05-03 03:04:43 +00:00
|
|
|
# These are extensions that must be enabled in order to support this database
|
|
|
|
enable_extension "plpgsql"
|
|
|
|
|
|
|
|
create_table "active_storage_attachments", force: :cascade do |t|
|
|
|
|
t.string "name", null: false
|
|
|
|
t.string "record_type", null: false
|
|
|
|
t.bigint "record_id", null: false
|
|
|
|
t.bigint "blob_id", null: false
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
|
|
|
|
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "active_storage_blobs", force: :cascade do |t|
|
|
|
|
t.string "key", null: false
|
|
|
|
t.string "filename", null: false
|
|
|
|
t.string "content_type"
|
|
|
|
t.text "metadata"
|
|
|
|
t.string "service_name", null: false
|
|
|
|
t.bigint "byte_size", null: false
|
|
|
|
t.string "checksum"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "active_storage_variant_records", force: :cascade do |t|
|
|
|
|
t.bigint "blob_id", null: false
|
|
|
|
t.string "variation_digest", null: false
|
|
|
|
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "api_images", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
|
|
|
t.bigint "creator_id", null: false
|
|
|
|
t.inet "creator_ip_addr", null: false
|
|
|
|
t.string "artists", default: [], array: true
|
|
|
|
t.string "sources", default: [], array: true
|
|
|
|
t.integer "width", null: false
|
|
|
|
t.integer "height", null: false
|
|
|
|
t.string "mime_type", null: false
|
|
|
|
t.string "category", null: false
|
|
|
|
t.string "original_url"
|
|
|
|
t.string "file_ext", null: false
|
|
|
|
t.integer "file_size", null: false
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.index ["creator_id"], name: "index_api_images_on_creator_id"
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "api_keys", force: :cascade do |t|
|
|
|
|
t.bigint "owner_id", null: false
|
|
|
|
t.boolean "active", default: true, null: false
|
|
|
|
t.boolean "disabled", default: false, null: false
|
|
|
|
t.boolean "super", default: false, null: false
|
|
|
|
t.boolean "unlimited", default: false, null: false
|
|
|
|
t.integer "bulk_limit", default: 100, null: false
|
|
|
|
t.integer "flags", default: 7, null: false
|
|
|
|
t.integer "limit_long", default: 12, null: false
|
|
|
|
t.integer "limit_short", default: 4, null: false
|
|
|
|
t.integer "window_long", default: 10000, null: false
|
|
|
|
t.integer "window_short", default: 2000, null: false
|
|
|
|
t.string "application_name", null: false
|
|
|
|
t.string "usage", default: "", null: false
|
|
|
|
t.string "disabled_reason"
|
|
|
|
t.string "key", null: false
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.index ["owner_id"], name: "index_api_keys_on_owner_id"
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "api_usages", force: :cascade do |t|
|
|
|
|
t.bigint "user_id"
|
|
|
|
t.bigint "api_key_id"
|
|
|
|
t.text "user_agent", default: "", null: false
|
|
|
|
t.text "method", default: "GET", null: false
|
|
|
|
t.text "path", default: "/", null: false
|
|
|
|
t.jsonb "params", default: "{}", null: false
|
|
|
|
t.text "service", null: false
|
|
|
|
t.inet "ip_addr", null: false
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.index ["api_key_id"], name: "index_api_usages_on_api_key_id"
|
|
|
|
t.index ["user_id"], name: "index_api_usages_on_user_id"
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "api_users", force: :cascade do |t|
|
|
|
|
t.integer "level", null: false
|
|
|
|
t.string "name", null: false
|
|
|
|
t.string "last_avatar_hash"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "e621_statuses", force: :cascade do |t|
|
|
|
|
t.integer "status", null: false
|
|
|
|
t.datetime "created_at", precision: 3, null: false
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "e621_thumbnails", force: :cascade do |t|
|
|
|
|
t.bigint "creator_id", null: false
|
|
|
|
t.bigint "api_key_id"
|
|
|
|
t.inet "creator_ip_addr", null: false
|
|
|
|
t.integer "post_id", null: false
|
|
|
|
t.uuid "md5", null: false
|
|
|
|
t.string "status", default: "pending", null: false
|
|
|
|
t.string "filetype", null: false
|
|
|
|
t.string "error_code"
|
|
|
|
t.datetime "expires_at"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.index ["api_key_id"], name: "index_e621_thumbnails_on_api_key_id"
|
|
|
|
t.index ["creator_id"], name: "index_e621_thumbnails_on_creator_id"
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "e621_webhooks", force: :cascade do |t|
|
|
|
|
t.string "channel_id", null: false
|
|
|
|
t.string "creator_id"
|
|
|
|
t.string "guild_id", null: false
|
|
|
|
t.string "webhook_id", null: false
|
|
|
|
t.string "webhook_token", null: false
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "exception_logs", force: :cascade do |t|
|
|
|
|
t.string "class_name"
|
|
|
|
t.inet "ip_addr"
|
|
|
|
t.string "version"
|
|
|
|
t.text "extra_params"
|
|
|
|
t.text "message"
|
|
|
|
t.text "trace"
|
|
|
|
t.uuid "code"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
end
|
|
|
|
|
|
|
|
create_table "short_urls", force: :cascade do |t|
|
|
|
|
t.bigint "creator_id", null: false
|
|
|
|
t.bigint "api_key_id"
|
|
|
|
t.inet "creator_ip_addr", null: false
|
|
|
|
t.string "code", null: false
|
|
|
|
t.string "url", null: false
|
|
|
|
t.integer "hits", default: 0, null: false
|
|
|
|
t.string "creator_name", null: false
|
|
|
|
t.string "creator_ua", null: false
|
|
|
|
t.string "management_code"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
|
|
|
t.index ["api_key_id"], name: "index_short_urls_on_api_key_id"
|
|
|
|
t.index ["code"], name: "index_short_urls_on_code", unique: true
|
|
|
|
t.index ["creator_id"], name: "index_short_urls_on_creator_id"
|
|
|
|
end
|
|
|
|
|
|
|
|
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
|
|
|
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
|
|
|
add_foreign_key "api_images", "api_users", column: "creator_id"
|
|
|
|
add_foreign_key "api_keys", "api_users", column: "owner_id"
|
|
|
|
add_foreign_key "api_usages", "api_users", column: "user_id"
|
|
|
|
add_foreign_key "e621_thumbnails", "api_users", column: "creator_id"
|
|
|
|
add_foreign_key "short_urls", "api_users", column: "creator_id"
|
|
|
|
end
|