1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-10 21:24:20 +01:00
fab-manager/db/migrate/20190521122429_create_invoicing_profiles.rb

24 lines
909 B
Ruby
Raw Normal View History

# frozen_string_literal:true
class CreateInvoicingProfiles < ActiveRecord::Migration[4.2]
2019-05-21 16:07:40 +02:00
def change
create_table :invoicing_profiles do |t|
t.references :user, index: true, foreign_key: true
t.string :first_name
t.string :last_name
t.string :email
2019-05-21 16:07:40 +02:00
t.timestamps null: false
end
add_reference :organizations, :invoicing_profile, index: true, foreign_key: true
add_reference :invoices, :invoicing_profile, index: true, foreign_key: true
add_reference :wallets, :invoicing_profile, index: true, foreign_key: true
add_reference :wallet_transactions, :invoicing_profile, index: true, foreign_key: true
add_reference :history_values, :invoicing_profile, index: true, foreign_key: true
add_column :invoices, :operator_profile_id, :integer
add_foreign_key :invoices, :invoicing_profiles, column: :operator_profile_id, primary_key: :id
2019-05-21 16:07:40 +02:00
end
end