# encoding:utf-8
class CreateLiveBroads < ActiveRecord::Migration
  def up
    #直播间管理
    create_table :live_broads do |t|
      # 直播标题
      t.column :title, :string,:limit => 128, :null=>false
      #封面
      t.column :cover, :string,:limit => 256
      #房间号
      t.column :room_id, :integer,:null=>false, :default => 0
      #开始时间
      t.column :begin_time,:datetime
      #结束时间
      t.column :end_time,:datetime
      # 置顶
      t.column :show, :boolean, :default=>false
      # 备注
      t.column :remark, :string,:limit => 256
      t.timestamps
    end
    add_index :live_broads, :room_id
    add_column :products, :live, :boolean, :default=>false

  end

  def down
  	drop_table :live_broads
    remove_column :products, :live

  end
end
