class CreatePPriceCatPDegressifs < ActiveRecord::Migration
  def change
    create_table :p_price_cat_p_degressifs do |t|
      t.references :p_price_cat, index: true, foreign_key: true
      t.references :p_degressif, index: true, foreign_key: true

      t.timestamps null: false
    end
    
    PDegressif.all.each do |pd|
      pd.p_price_cats << PPriceCat.all
      pd.save
    end
    
    
  end
end
