residency/db/schema.rb
2023-01-25 22:15:54 +02:00

309 lines
14 KiB
Ruby
Generated

# 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.
ActiveRecord::Schema[7.0].define(version: 2023_01_25_172223) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "friendly_id_slugs", force: :cascade do |t|
t.string "slug", null: false
t.integer "sluggable_id", null: false
t.string "sluggable_type", limit: 50
t.string "scope"
t.datetime "created_at", precision: nil
t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true
t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type"
t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id"
t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type"
end
create_table "members", force: :cascade do |t|
t.string "name"
t.string "bio"
t.string "picture"
t.boolean "public"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email"
t.date "arrived"
t.date "left"
t.index ["email"], name: "index_members_on_email", unique: true
t.index ["reset_password_token"], name: "index_members_on_reset_password_token", unique: true
end
create_table "pictures", force: :cascade do |t|
t.string "picture"
t.string "text"
t.date "happened"
t.bigint "member_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["member_id"], name: "index_pictures_on_member_id"
end
create_table "stories", force: :cascade do |t|
t.bigint "member_id"
t.string "picture"
t.string "header"
t.text "text"
t.date "happened"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["member_id"], name: "index_stories_on_member_id"
end
create_table "thredded_categories", force: :cascade do |t|
t.bigint "messageboard_id", null: false
t.text "name", null: false
t.text "description"
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.text "slug", null: false
t.index "lower(name) text_pattern_ops", name: "thredded_categories_name_ci"
t.index ["messageboard_id", "slug"], name: "index_thredded_categories_on_messageboard_id_and_slug", unique: true
t.index ["messageboard_id"], name: "index_thredded_categories_on_messageboard_id"
end
create_table "thredded_messageboard_groups", force: :cascade do |t|
t.string "name"
t.integer "position", null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
end
create_table "thredded_messageboard_notifications_for_followed_topics", force: :cascade do |t|
t.bigint "user_id", null: false
t.bigint "messageboard_id", null: false
t.string "notifier_key", limit: 90, null: false
t.boolean "enabled", default: true, null: false
t.index ["user_id", "messageboard_id", "notifier_key"], name: "thredded_messageboard_notifications_for_followed_topics_unique", unique: true
end
create_table "thredded_messageboard_users", force: :cascade do |t|
t.bigint "thredded_user_detail_id", null: false
t.bigint "thredded_messageboard_id", null: false
t.datetime "last_seen_at", precision: nil, null: false
t.index ["thredded_messageboard_id", "last_seen_at"], name: "index_thredded_messageboard_users_for_recently_active"
t.index ["thredded_messageboard_id", "thredded_user_detail_id"], name: "index_thredded_messageboard_users_primary", unique: true
end
create_table "thredded_messageboards", force: :cascade do |t|
t.text "name", null: false
t.text "slug"
t.text "description"
t.integer "topics_count", default: 0
t.integer "posts_count", default: 0
t.integer "position", null: false
t.bigint "last_topic_id"
t.bigint "messageboard_group_id"
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.boolean "locked", default: false, null: false
t.index ["messageboard_group_id"], name: "index_thredded_messageboards_on_messageboard_group_id"
t.index ["slug"], name: "index_thredded_messageboards_on_slug", unique: true
end
create_table "thredded_notifications_for_followed_topics", force: :cascade do |t|
t.bigint "user_id", null: false
t.string "notifier_key", limit: 90, null: false
t.boolean "enabled", default: true, null: false
t.index ["user_id", "notifier_key"], name: "thredded_notifications_for_followed_topics_unique", unique: true
end
create_table "thredded_notifications_for_private_topics", force: :cascade do |t|
t.bigint "user_id", null: false
t.string "notifier_key", limit: 90, null: false
t.boolean "enabled", default: true, null: false
t.index ["user_id", "notifier_key"], name: "thredded_notifications_for_private_topics_unique", unique: true
end
create_table "thredded_post_moderation_records", force: :cascade do |t|
t.bigint "post_id"
t.bigint "messageboard_id"
t.text "post_content"
t.bigint "post_user_id"
t.text "post_user_name"
t.bigint "moderator_id"
t.integer "moderation_state", null: false
t.integer "previous_moderation_state", null: false
t.datetime "created_at", precision: nil, null: false
t.index ["messageboard_id", "created_at"], name: "index_thredded_moderation_records_for_display", order: { created_at: :desc }
end
create_table "thredded_posts", force: :cascade do |t|
t.bigint "user_id"
t.text "content"
t.string "source", limit: 191, default: "web"
t.bigint "postable_id", null: false
t.bigint "messageboard_id", null: false
t.integer "moderation_state", null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.index "to_tsvector('english'::regconfig, content)", name: "thredded_posts_content_fts", using: :gist
t.index ["messageboard_id"], name: "index_thredded_posts_on_messageboard_id"
t.index ["moderation_state", "updated_at"], name: "index_thredded_posts_for_display"
t.index ["postable_id", "created_at"], name: "index_thredded_posts_on_postable_id_and_created_at"
t.index ["postable_id"], name: "index_thredded_posts_on_postable_id"
t.index ["user_id"], name: "index_thredded_posts_on_user_id"
end
create_table "thredded_private_posts", force: :cascade do |t|
t.bigint "user_id"
t.text "content"
t.bigint "postable_id", null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.index ["postable_id", "created_at"], name: "index_thredded_private_posts_on_postable_id_and_created_at"
end
create_table "thredded_private_topics", force: :cascade do |t|
t.bigint "user_id"
t.bigint "last_user_id"
t.text "title", null: false
t.text "slug", null: false
t.integer "posts_count", default: 0
t.string "hash_id", limit: 20, null: false
t.datetime "last_post_at", precision: nil
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.index ["hash_id"], name: "index_thredded_private_topics_on_hash_id"
t.index ["last_post_at"], name: "index_thredded_private_topics_on_last_post_at"
t.index ["slug"], name: "index_thredded_private_topics_on_slug", unique: true
end
create_table "thredded_private_users", force: :cascade do |t|
t.bigint "private_topic_id"
t.bigint "user_id"
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.index ["private_topic_id"], name: "index_thredded_private_users_on_private_topic_id"
t.index ["user_id"], name: "index_thredded_private_users_on_user_id"
end
create_table "thredded_topic_categories", force: :cascade do |t|
t.bigint "topic_id", null: false
t.bigint "category_id", null: false
t.index ["category_id"], name: "index_thredded_topic_categories_on_category_id"
t.index ["topic_id"], name: "index_thredded_topic_categories_on_topic_id"
end
create_table "thredded_topics", force: :cascade do |t|
t.bigint "user_id"
t.bigint "last_user_id"
t.text "title", null: false
t.text "slug", null: false
t.bigint "messageboard_id", null: false
t.integer "posts_count", default: 0, null: false
t.boolean "sticky", default: false, null: false
t.boolean "locked", default: false, null: false
t.string "hash_id", limit: 20, null: false
t.integer "moderation_state", null: false
t.datetime "last_post_at", precision: nil
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.index "to_tsvector('english'::regconfig, title)", name: "thredded_topics_title_fts", using: :gist
t.index ["hash_id"], name: "index_thredded_topics_on_hash_id"
t.index ["last_post_at"], name: "index_thredded_topics_on_last_post_at"
t.index ["messageboard_id"], name: "index_thredded_topics_on_messageboard_id"
t.index ["moderation_state", "sticky", "updated_at"], name: "index_thredded_topics_for_display", order: { sticky: :desc, updated_at: :desc }
t.index ["slug"], name: "index_thredded_topics_on_slug", unique: true
t.index ["user_id"], name: "index_thredded_topics_on_user_id"
end
create_table "thredded_user_details", force: :cascade do |t|
t.bigint "user_id", null: false
t.datetime "latest_activity_at", precision: nil
t.integer "posts_count", default: 0
t.integer "topics_count", default: 0
t.datetime "last_seen_at", precision: nil
t.integer "moderation_state", default: 0, null: false
t.datetime "moderation_state_changed_at", precision: nil
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.index ["latest_activity_at"], name: "index_thredded_user_details_on_latest_activity_at"
t.index ["moderation_state", "moderation_state_changed_at"], name: "index_thredded_user_details_for_moderations", order: { moderation_state_changed_at: :desc }
t.index ["user_id"], name: "index_thredded_user_details_on_user_id", unique: true
end
create_table "thredded_user_messageboard_preferences", force: :cascade do |t|
t.bigint "user_id", null: false
t.bigint "messageboard_id", null: false
t.boolean "follow_topics_on_mention", default: true, null: false
t.boolean "auto_follow_topics", default: false, null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.index ["user_id", "messageboard_id"], name: "thredded_user_messageboard_preferences_user_id_messageboard_id", unique: true
end
create_table "thredded_user_post_notifications", force: :cascade do |t|
t.bigint "user_id", null: false
t.bigint "post_id", null: false
t.datetime "notified_at", precision: nil, null: false
t.index ["post_id"], name: "index_thredded_user_post_notifications_on_post_id"
t.index ["user_id", "post_id"], name: "index_thredded_user_post_notifications_on_user_id_and_post_id", unique: true
end
create_table "thredded_user_preferences", force: :cascade do |t|
t.bigint "user_id", null: false
t.boolean "follow_topics_on_mention", default: true, null: false
t.boolean "auto_follow_topics", default: false, null: false
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.index ["user_id"], name: "index_thredded_user_preferences_on_user_id", unique: true
end
create_table "thredded_user_private_topic_read_states", force: :cascade do |t|
t.bigint "user_id", null: false
t.bigint "postable_id", null: false
t.integer "unread_posts_count", default: 0, null: false
t.integer "read_posts_count", default: 0, null: false
t.integer "integer", default: 0, null: false
t.datetime "read_at", precision: nil, null: false
t.index ["user_id", "postable_id"], name: "thredded_user_private_topic_read_states_user_postable", unique: true
end
create_table "thredded_user_topic_follows", force: :cascade do |t|
t.bigint "user_id", null: false
t.bigint "topic_id", null: false
t.datetime "created_at", precision: nil, null: false
t.integer "reason", limit: 2
t.index ["user_id", "topic_id"], name: "thredded_user_topic_follows_user_topic", unique: true
end
create_table "thredded_user_topic_read_states", force: :cascade do |t|
t.bigint "messageboard_id", null: false
t.bigint "user_id", null: false
t.bigint "postable_id", null: false
t.integer "unread_posts_count", default: 0, null: false
t.integer "read_posts_count", default: 0, null: false
t.integer "integer", default: 0, null: false
t.datetime "read_at", precision: nil, null: false
t.index ["messageboard_id"], name: "index_thredded_user_topic_read_states_on_messageboard_id"
t.index ["user_id", "messageboard_id"], name: "thredded_user_topic_read_states_user_messageboard"
t.index ["user_id", "postable_id"], name: "thredded_user_topic_read_states_user_postable", unique: true
end
add_foreign_key "pictures", "members"
add_foreign_key "thredded_messageboard_users", "thredded_messageboards", on_delete: :cascade
add_foreign_key "thredded_messageboard_users", "thredded_user_details", on_delete: :cascade
add_foreign_key "thredded_user_post_notifications", "members", column: "user_id", on_delete: :cascade
add_foreign_key "thredded_user_post_notifications", "thredded_posts", column: "post_id", on_delete: :cascade
end