class EnhanceRecordingsForReplayModule < ActiveRecord::Migration[7.2]
  def change
    change_table :recordings, bulk: true do |t|
      t.string :title
      t.string :privacy_status, null: false, default: "unlisted"
      t.bigint :byte_size
      t.integer :duration_secs
      t.string :storage_key
      t.string :storage_bucket
      t.string :storage_backend, null: false, default: "local"
      t.datetime :recorded_at
      t.datetime :deleted_at
      t.text :error_message
    end

    add_index :recordings, :privacy_status
    add_index :recordings, :deleted_at
    add_index :recordings, %i[team_id status]
    add_index :recordings, :storage_key, unique: true, where: "storage_key IS NOT NULL"
  end
end
