# 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