20210220114641_create_product_commends.rb 962 B

12345678910111213141516171819202122232425262728293031323334353637
  1. # encoding:utf-8
  2. class CreateProductCommends < ActiveRecord::Migration
  3. def up
  4. #商品评论管理
  5. create_table :product_commends do |t|
  6. #微信ID
  7. t.column :wx_user_id, :integer,:null=>false, :default => 0
  8. #商品ID
  9. t.column :product_id, :integer,:null=>false, :default => 0
  10. #订单号
  11. t.column :order_id, :string,:limit => 256
  12. # 文字
  13. t.column :detail, :string,:limit => 256
  14. #评分
  15. t.column :score, :integer,:null=>false, :default => 0
  16. # 状态
  17. t.column :is_enable, :boolean, :default=>false
  18. # 是否置顶
  19. t.column :is_top, :boolean, :default=>false
  20. # 推荐程度
  21. t.column :recommend, :boolean, :default=>false
  22. # 备注
  23. t.column :remark, :string,:limit => 256
  24. t.timestamps
  25. end
  26. add_index :product_commends, :wx_user_id
  27. add_index :product_commends, :product_id
  28. end
  29. def down
  30. drop_table :product_commends
  31. end
  32. end