Browse Source

#1 順番修正

#23
みてるぞ 4 months ago
parent
commit
c6deba7c26
4 changed files with 119 additions and 3 deletions
  1. +0
    -0
      backend/db/migrate/20250227210500_create_tags.rb
  2. +0
    -0
      backend/db/migrate/20250227211300_create_users.rb
  3. +0
    -0
      backend/db/migrate/20250227211400_create_posts.rb
  4. +119
    -3
      backend/db/schema.rb

backend/db/migrate/20250227213200_create_tags.rb → backend/db/migrate/20250227210500_create_tags.rb View File


backend/db/migrate/20250227213900_create_users.rb → backend/db/migrate/20250227211300_create_users.rb View File


backend/db/migrate/20250227212100_create_posts.rb → backend/db/migrate/20250227211400_create_posts.rb View File


+ 119
- 3
backend/db/schema.rb View File

@@ -10,11 +10,127 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[8.0].define(version: 2025_02_25_131718) do
ActiveRecord::Schema[8.0].define(version: 2025_02_27_214100) do
create_table "ip_addresses", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.binary "ip_adress", limit: 16, null: false
t.boolean "banned", default: false, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "nico_tag_relations", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.bigint "nico_tag_id", null: false
t.bigint "tag_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["nico_tag_id"], name: "index_nico_tag_relations_on_nico_tag_id"
t.index ["tag_id"], name: "index_nico_tag_relations_on_tag_id"
end

create_table "post_tags", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.bigint "post_id", null: false
t.bigint "tag_id", null: false
t.bigint "created_by_id"
t.bigint "deleted_by_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["created_by_id"], name: "index_post_tags_on_created_by_id"
t.index ["deleted_by_id"], name: "index_post_tags_on_deleted_by_id"
t.index ["post_id"], name: "index_post_tags_on_post_id"
t.index ["tag_id"], name: "index_post_tags_on_tag_id"
end

create_table "posts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "title"
t.text "body"
t.string "url", limit: 2000, null: false
t.string "thumbnail", null: false
t.string "thumbnail_base", limit: 2000, null: false
t.bigint "post_id"
t.bigint "uploaded_by_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["post_id"], name: "index_posts_on_post_id"
t.index ["uploaded_by_id"], name: "index_posts_on_uploaded_by_id"
end

create_table "settings", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.bigint "user_id", null: false
t.string "key", null: false
t.json "value", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["user_id"], name: "index_settings_on_user_id"
end

create_table "tag_aliases", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.bigint "tag_id", null: false
t.string "name", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["tag_id"], name: "index_tag_aliases_on_tag_id"
end

create_table "tags", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "name", null: false
t.string "category", default: "general", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "user_ips", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.bigint "user_id", null: false
t.bigint "ip_address_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["ip_address_id"], name: "index_user_ips_on_ip_address_id"
t.index ["user_id"], name: "index_user_ips_on_user_id"
end

create_table "user_post_views", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.bigint "user_id", null: false
t.bigint "post_id", null: false
t.boolean "viewed", default: false, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["post_id"], name: "index_user_post_views_on_post_id"
t.index ["user_id"], name: "index_user_post_views_on_user_id"
end

create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "name"
t.string "inheritance_code", limit: 64, null: false
t.string "role", null: false
t.boolean "banned", default: false, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "wiki_pages", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "title", null: false
t.bigint "tag_id"
t.bigint "created_by_id", null: false
t.bigint "updated_by_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["created_by_id"], name: "index_wiki_pages_on_created_by_id"
t.index ["tag_id"], name: "index_wiki_pages_on_tag_id"
t.index ["updated_by_id"], name: "index_wiki_pages_on_updated_by_id"
end

add_foreign_key "nico_tag_relations", "tags"
add_foreign_key "nico_tag_relations", "tags", column: "nico_tag_id"
add_foreign_key "post_tags", "posts"
add_foreign_key "post_tags", "tags"
add_foreign_key "post_tags", "users", column: "created_by_id"
add_foreign_key "post_tags", "users", column: "deleted_by_id"
add_foreign_key "posts", "posts"
add_foreign_key "posts", "users", column: "uploaded_by_id"
add_foreign_key "settings", "users"
add_foreign_key "tag_aliases", "tags"
add_foreign_key "user_ips", "ip_addresses"
add_foreign_key "user_ips", "users"
add_foreign_key "user_post_views", "posts"
add_foreign_key "user_post_views", "users"
add_foreign_key "wiki_pages", "tags"
add_foreign_key "wiki_pages", "users", column: "created_by_id"
add_foreign_key "wiki_pages", "users", column: "updated_by_id"
end

Loading…
Cancel
Save