20180810070807_create_wx_user_gongzhonghao.rb 868 B

1234567891011121314151617181920212223242526272829
  1. class CreateWxUserGongzhonghao < ActiveRecord::Migration
  2. def change
  3. create_table :wx_user_gongzhonghaos do |t|
  4. #微信用户ID
  5. t.integer :wx_user_id, :null => false
  6. #appid
  7. t.string :app_id, :null => false
  8. #openid
  9. t.string :gzh_open_id, :limit => 64
  10. t.boolean :subscribe
  11. t.integer :subscribe_time
  12. t.integer :unsubscribe_time
  13. t.integer :last_conversation_at
  14. t.timestamps
  15. end
  16. add_index :wx_user_gongzhonghaos, :app_id
  17. add_index :wx_user_gongzhonghaos, :gzh_open_id
  18. add_index :wx_user_gongzhonghaos, :wx_user_id
  19. end
  20. def self.down
  21. remove_index :wx_user_gongzhonghaos, :app_id
  22. remove_index :wx_user_gongzhonghaos, :gzh_open_id
  23. remove_index :wx_user_gongzhonghaos, :wx_user_id
  24. drop_table :wx_user_gongzhonghaos
  25. end
  26. end