Browse Source

#295

feature/295
みてるぞ 1 week ago
parent
commit
72d24c8c80
3 changed files with 63 additions and 1 deletions
  1. +15
    -0
      backend/db/migrate/20260316082500_create_theatres.rb
  2. +12
    -0
      backend/db/migrate/20260316083500_create_theatre_comments.rb
  3. +36
    -1
      backend/db/schema.rb

+ 15
- 0
backend/db/migrate/20260316082500_create_theatres.rb View File

@@ -0,0 +1,15 @@
class CreateTheatres < ActiveRecord::Migration[8.0]
def change
create_table :theatres do |t|
t.string :name
t.datetime :opens_at, null: false, index: true
t.datetime :closes_at, index: true
t.references :current_post, foreign_key: { to_table: :posts }, index: true
t.datetime :current_post_started_at
t.integer :next_comment_no, null: false, default: 1
t.references :created_by_user, null: false, foreign_key: { to_table: :users }, index: true
t.timestamps
t.datetime :discarded_at, index: true
end
end
end

+ 12
- 0
backend/db/migrate/20260316083500_create_theatre_comments.rb View File

@@ -0,0 +1,12 @@
class CreateTheatreComments < ActiveRecord::Migration[8.0]
def change
create_table :theatre_comments, primary_key: [:theatre_id, :no] do |t|
t.references :theatre, null: false, foreign_key: { to_table: :theatres }
t.integer :no, null: false
t.references :user, foreign_key: { to_table: :users }
t.text :content, null: false
t.timestamps
t.datetime :discarded_at, index: true
end
end
end

+ 36
- 1
backend/db/schema.rb View File

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


ActiveRecord::Schema[8.0].define(version: 2026_03_11_232300) do
ActiveRecord::Schema[8.0].define(version: 2026_03_16_083500) do
create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "name", null: false t.string "name", null: false
t.string "record_type", null: false t.string "record_type", null: false
@@ -167,6 +167,37 @@ ActiveRecord::Schema[8.0].define(version: 2026_03_11_232300) do
t.index ["tag_name_id"], name: "index_tags_on_tag_name_id", unique: true t.index ["tag_name_id"], name: "index_tags_on_tag_name_id", unique: true
end end


create_table "theatre_comments", primary_key: ["theatre_id", "no"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.bigint "theatre_id", null: false
t.integer "no", null: false
t.bigint "user_id"
t.text "content", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "discarded_at"
t.index ["discarded_at"], name: "index_theatre_comments_on_discarded_at"
t.index ["theatre_id"], name: "index_theatre_comments_on_theatre_id"
t.index ["user_id"], name: "index_theatre_comments_on_user_id"
end

create_table "theatres", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "name"
t.datetime "opens_at", null: false
t.datetime "closes_at"
t.bigint "current_post_id"
t.datetime "current_post_started_at"
t.integer "next_comment_no", default: 1, null: false
t.bigint "created_by_user_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "discarded_at"
t.index ["closes_at"], name: "index_theatres_on_closes_at"
t.index ["created_by_user_id"], name: "index_theatres_on_created_by_user_id"
t.index ["current_post_id"], name: "index_theatres_on_current_post_id"
t.index ["discarded_at"], name: "index_theatres_on_discarded_at"
t.index ["opens_at"], name: "index_theatres_on_opens_at"
end

create_table "user_ips", primary_key: ["user_id", "ip_address_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| create_table "user_ips", primary_key: ["user_id", "ip_address_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.bigint "user_id", null: false t.bigint "user_id", null: false
t.bigint "ip_address_id", null: false t.bigint "ip_address_id", null: false
@@ -262,6 +293,10 @@ ActiveRecord::Schema[8.0].define(version: 2026_03_11_232300) do
add_foreign_key "tag_similarities", "tags" add_foreign_key "tag_similarities", "tags"
add_foreign_key "tag_similarities", "tags", column: "target_tag_id" add_foreign_key "tag_similarities", "tags", column: "target_tag_id"
add_foreign_key "tags", "tag_names" add_foreign_key "tags", "tag_names"
add_foreign_key "theatre_comments", "theatres"
add_foreign_key "theatre_comments", "users"
add_foreign_key "theatres", "posts", column: "current_post_id"
add_foreign_key "theatres", "users", column: "created_by_user_id"
add_foreign_key "user_ips", "ip_addresses" add_foreign_key "user_ips", "ip_addresses"
add_foreign_key "user_ips", "users" add_foreign_key "user_ips", "users"
add_foreign_key "user_post_views", "posts" add_foreign_key "user_post_views", "posts"


Loading…
Cancel
Save