sideplace_app/db/migrate/20150614114000_create_orders.rb

53 lines
1.3 KiB
Ruby

class CreateOrders < ActiveRecord::Migration
def change
create_table :orders do |t|
t.references :annonce_account, index: true
t.references :credit_product, index: true
t.datetime :paid_at
t.boolean :paid
t.boolean :unpaid
t.datetime :unpaid_at
t.integer :payment_type_id
t.string :reduction_code
t.integer :reduction_percentage
t.decimal :reduction_value
t.decimal :amount_ht
t.decimal :amount_ttc
#product
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
#coordonnees
t.string :username
t.string :name
t.string :firstname
t.string :organisation
t.string :siret
t.string :address
t.string :address2
t.string :cp
t.string :city
t.string :country
t.string :tva_intra
t.boolean :pro, :default => false
t.boolean :cgv
t.boolean :retractation
t.boolean :troisd
t.timestamps null: false
end
add_foreign_key :orders, :annonce_accounts
add_foreign_key :orders, :credit_products
end
end