20161014040139_create_wx_gongzhonghaos.rb 774 B

123456789101112131415161718192021222324252627282930
  1. #微信公众号
  2. class CreateWxGongzhonghaos < ActiveRecord::Migration
  3. def self.up
  4. create_table :wx_gongzhonghaos do |t|
  5. #公众号id
  6. t.string :wx_hao, :null => false
  7. #公众号名称
  8. t.string :wx_name, :null => false
  9. #类型
  10. t.column :wx_type, "ENUM('service','subscribe') NOT NULL DEFAULT 'service'"
  11. #认证
  12. t.boolean :is_authed, :default => false
  13. t.string :app_id, :null => false
  14. t.string :app_secret
  15. t.string :token
  16. # 关注时回复
  17. t.text :sub_return_text
  18. t.timestamps
  19. end
  20. add_index :wx_gongzhonghaos, :wx_hao, :unique => true
  21. add_index :wx_gongzhonghaos, :app_id, :unique => true
  22. end
  23. def self.down
  24. drop_table :wx_gongzhonghaos
  25. end
  26. end