20210220114641_create_product_commends.rb 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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, :integer,:null=>false, :default => 0
  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. add_column :order_details, :commend, :boolean, :default=>false
  29. end
  30. def down
  31. drop_table :product_commends
  32. end
  33. end