20210220114641_create_product_commend_biaozhuns.rb 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. #单牛记录表
  27. create_table :d5c_project_traces do |t|
  28. #项目id
  29. t.column :project_id, :integer, :null => false, :default=>0
  30. # 同步追溯ID
  31. t.column :sync_record_id, :integer, :default=>0
  32. #所在棚栏
  33. t.column :location, :string, :limit => 100
  34. #头图
  35. t.column :img_head, :string, :limit => 255
  36. #图片一
  37. t.column :img_one, :string, :limit => 255
  38. #图片二
  39. t.column :img_two, :string, :limit => 255
  40. #视频链接
  41. t.column :url, :string, :limit => 200
  42. #记录内容
  43. t.column :about, :string, :limit => 500
  44. #上件文件
  45. t.column :up_file, :string, :limit => 255
  46. #状态:0项目成功,1采购中,2入栏
  47. t.column :state, :tinyint, :limit => 4, :default => 0
  48. #用户id
  49. t.column :user_id, :integer, :null => false, :default=>0
  50. # 排序
  51. t.column :sort, :integer, :default=>0
  52. #是否显示:0否,1是
  53. t.column :audit, :boolean, :default => true
  54. #编辑人
  55. t.column :editor, :string, :limit => 100
  56. #时间戳
  57. t.timestamps
  58. end
  59. add_index :product_commends, :wx_user_id
  60. add_index :product_commends, :product_id
  61. add_column :order_details, :commend, :boolean, :default=>false
  62. end
  63. def down
  64. drop_table :product_commends
  65. end
  66. end