20180917093042_create_sign_up_channel_qrcode_results.rb 845 B

1234567891011121314151617181920
  1. class CreateSignUpChannelQrcodeResults < ActiveRecord::Migration
  2. def change
  3. create_table :sign_up_channel_qrcode_results do |t|
  4. t.column :wx_uid, :integer, :null => false, :default => 0
  5. t.column :sign_up_channel_id, :integer
  6. t.timestamps
  7. end
  8. add_index :sign_up_channel_qrcode_results, :wx_uid
  9. add_index :sign_up_channel_qrcode_results, :sign_up_channel_id
  10. add_index :sign_up_channel_qrcode_results, [:wx_uid,:sign_up_channel_id], :unique => true, :name=>"idx_su_cq_result_wxuid_and_channel_id"
  11. end
  12. def self.down
  13. remove_index :sign_up_channel_qrcode_results, :wx_uid
  14. remove_index :sign_up_channel_qrcode_results, :sign_up_channel_id
  15. remove_index :sign_up_channel_qrcode_results, name: "idx_su_cq_result_wxuid_and_channel_id"
  16. drop_table :sign_up_channel_qrcode_results
  17. end
  18. end