20180809015509_create_share_info.rb 971 B

1234567891011121314151617181920212223242526272829303132
  1. class CreateShareInfo < ActiveRecord::Migration
  2. def change
  3. create_table :share_infos do |t|
  4. #分享活动类型:商品销售专题、商品详情页
  5. t.string :share_code, :null => false
  6. #关联ID
  7. t.string :relate_id, :null => false
  8. #关联ID的相关,如活动订单的分享,这个字段可以存活动ID
  9. t.string :relate_parent, :null => false
  10. #用户ID
  11. t.integer :wx_user_id, :default => 0
  12. #分享朋友圈,还是朋友group,timeline
  13. t.string :share_to, :null => false, :limit => 20
  14. #IP
  15. t.string :ip, :null => false
  16. #分享次数
  17. t.integer :share_times, :default => 0
  18. #最新分享时间
  19. t.datetime :share_latest_time
  20. t.timestamps
  21. end
  22. add_index :share_infos, :relate_id
  23. add_index :share_infos, :share_code
  24. add_index :share_infos, :relate_parent
  25. end
  26. def down
  27. drop_table :share_infos
  28. end
  29. end