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
