瀏覽代碼

增加商品pv

abiao 4 年之前
父節點
當前提交
015b8f8d27
共有 3 個文件被更改,包括 17 次插入0 次删除
  1. 1 0
      app/models/order.rb
  2. 1 0
      app/models/order_detail.rb
  3. 15 0
      db/migrate/20210805032357_add_pv_column_to_products.rb

+ 1 - 0
app/models/order.rb

@@ -246,6 +246,7 @@ class Order < ActiveRecord::Base
                 filterable true
             end
             field :depart_record
+            field :pv
             field :created_at do
                 visible false
             end

+ 1 - 0
app/models/order_detail.rb

@@ -120,6 +120,7 @@ class OrderDetail < ActiveRecord::Base
       field :is_zeng
       field :size_name
       field :color_name
+      field :pv
       field :created_at
       field :updated_at
     end

+ 15 - 0
db/migrate/20210805032357_add_pv_column_to_products.rb

@@ -0,0 +1,15 @@
+# This migration and CreateVersionAssociations provide the necessary
+# schema for tracking associations.
+class AddPvColumnToProducts < ActiveRecord::Migration
+  def self.up
+    add_column :products, :pv,  :integer, :limit => 11, :default => 0
+    add_column :orders,   :pv , :integer, :limit => 11, :default => 0
+    add_column :order_details,  :pv , :integer, :limit => 11, :default => 0
+  end
+
+  def self.down
+    remove_column :products, :pv
+    remove_column :orders, :pv
+    remove_column :order_details, :pv
+  end
+end