class CreateCreditProducts < ActiveRecord::Migration
  def change
    create_table :credit_products do |t|
      t.string :name
      t.text :description
      t.integer :nbr_credits
      t.integer :validity
      t.decimal :price_ht, :precision => 10, :scale => 2
      t.integer :binary_points
      t.integer :binary_percentage
      t.timestamps null: false
    end
    
    CreditProduct.create(:name => "Start", :nbr_credits => 40 , :validity => 6, :price_ht => 60 , :binary_points => 10, :binary_percentage => 10)
    CreditProduct.create(:name => "Start plus", :nbr_credits =>  120, :validity => 6, :price_ht => 125, :binary_points => 20, :binary_percentage => 20)
    CreditProduct.create(:name => "Premium", :nbr_credits => 260, :validity => 6, :price_ht => 250, :binary_points => 40, :binary_percentage => 30)
    CreditProduct.create(:name => "Business", :nbr_credits => 550, :validity => 6, :price_ht => 500, :binary_points => 80, :binary_percentage => 40)
    CreditProduct.create(:name => "Partenaire", :nbr_credits => 1200, :validity => 6, :price_ht => 1000, :binary_points => 160, :binary_percentage => 50)
  end
end
