Ver código fonte

add balance promotion shop promotion

abiao 4 anos atrás
pai
commit
3e233da0ad

+ 43 - 0
db/migrate/20210329114688_create_related_promotions.rb

@@ -0,0 +1,43 @@
+# encoding:utf-8
+class CreateRelatedPromotions < ActiveRecord::Migration
+  def up
+
+    create_table :promotions_depart_records do |t|
+      t.integer :promotion_id
+      t.integer :depart_record_id
+    end
+
+    create_table :shop_promotions_depart_records do |t|
+      t.integer :shop_promotion_id
+      t.integer :depart_record_id
+    end
+
+
+    create_table :balance_promotions_depart_records do |t|
+      t.integer :balance_promotion_id
+      t.integer :depart_record_id
+    end
+
+
+    add_index :promotions_depart_records,
+              [:promotion_id, :depart_record_id],
+              :name => "idx_pomotion_d_r_id"
+
+    add_index :shop_promotions_depart_records,
+              [:shop_promotion_id, :depart_record_id],
+              :name => "idx_shop_pomotion_d_r_id"
+
+
+    add_index :balance_promotions_depart_records,
+              [:balance_promotion_id, :depart_record_id],
+              :name => "idx_balance_pomotion_d_r_id"
+
+  end
+
+  def down
+    drop_table :promotions_depart_records
+    drop_table :shop_promotions_depart_records
+    drop_table :balance_promotions_depart_records
+  end
+
+end