上映会のし組み作り(#295) (#296)

#295

#295

#295

#295

#295

#295

#295

Co-authored-by: miteruzo <miteruzo@naver.com>
Reviewed-on: #296
This commit was merged in pull request #296.
This commit is contained in:
2026-03-18 23:01:04 +09:00
parent ffadd03c49
commit 8cf7107445
19 changed files with 858 additions and 61 deletions
@@ -0,0 +1,17 @@
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.integer :kind, null: false, 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 :host_user, foreign_key: { to_table: :users }
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
@@ -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
@@ -0,0 +1,12 @@
class CreateTheatreWatchingUsers < ActiveRecord::Migration[8.0]
def change
create_table :theatre_watching_users, primary_key: [:theatre_id, :user_id] do |t|
t.references :theatre, null: false, foreign_key: { to_table: :theatres }
t.references :user, null: false, foreign_key: { to_table: :users }, index: true
t.datetime :expires_at, null: false, index: true
t.timestamps
t.index [:theatre_id, :expires_at]
end
end
end
+55 -1
View File
@@ -10,7 +10,7 @@
#
# 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_17_015000) do
create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "name", null: false
t.string "record_type", null: false
@@ -167,6 +167,53 @@ 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
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 "theatre_watching_users", primary_key: ["theatre_id", "user_id"], charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.bigint "theatre_id", null: false
t.bigint "user_id", null: false
t.datetime "expires_at", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["expires_at"], name: "index_theatre_watching_users_on_expires_at"
t.index ["theatre_id", "expires_at"], name: "index_theatre_watching_users_on_theatre_id_and_expires_at"
t.index ["theatre_id"], name: "index_theatre_watching_users_on_theatre_id"
t.index ["user_id"], name: "index_theatre_watching_users_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.integer "kind", null: false
t.bigint "current_post_id"
t.datetime "current_post_started_at"
t.integer "next_comment_no", default: 1, null: false
t.bigint "host_user_id"
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 ["host_user_id"], name: "index_theatres_on_host_user_id"
t.index ["kind"], name: "index_theatres_on_kind"
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|
t.bigint "user_id", null: false
t.bigint "ip_address_id", null: false
@@ -262,6 +309,13 @@ ActiveRecord::Schema[8.0].define(version: 2026_03_11_232300) do
add_foreign_key "tag_similarities", "tags"
add_foreign_key "tag_similarities", "tags", column: "target_tag_id"
add_foreign_key "tags", "tag_names"
add_foreign_key "theatre_comments", "theatres"
add_foreign_key "theatre_comments", "users"
add_foreign_key "theatre_watching_users", "theatres"
add_foreign_key "theatre_watching_users", "users"
add_foreign_key "theatres", "posts", column: "current_post_id"
add_foreign_key "theatres", "users", column: "created_by_user_id"
add_foreign_key "theatres", "users", column: "host_user_id"
add_foreign_key "user_ips", "ip_addresses"
add_foreign_key "user_ips", "users"
add_foreign_key "user_post_views", "posts"