class CreateSignUpChannelQrcodeResults < ActiveRecord::Migration
  def change
    create_table :sign_up_channel_qrcode_results do |t|
      t.column   :wx_uid,  :integer, :null => false, :default => 0
      t.column   :sign_up_channel_id, :integer
      t.timestamps
    end
    add_index :sign_up_channel_qrcode_results, :wx_uid
    add_index :sign_up_channel_qrcode_results, :sign_up_channel_id
    add_index :sign_up_channel_qrcode_results, [:wx_uid,:sign_up_channel_id], :unique => true, :name=>"idx_su_cq_result_wxuid_and_channel_id"
  end

  def self.down
    remove_index :sign_up_channel_qrcode_results, :wx_uid
    remove_index :sign_up_channel_qrcode_results, :sign_up_channel_id
    remove_index :sign_up_channel_qrcode_results, name: "idx_su_cq_result_wxuid_and_channel_id"
    drop_table   :sign_up_channel_qrcode_results
  end
end
