Adding reference to account_invoice for each billable_period

This commit is contained in:
Rob Harrington
2015-09-16 16:31:28 +10:00
parent 0debdcdd9c
commit 4a8f9d1e36
2 changed files with 12 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
class AddAccountInvoiceToBillablePeriods < ActiveRecord::Migration
def change
add_column :billable_periods, :account_invoice_id, :integer, null: false
add_index :billable_periods, :account_invoice_id
add_foreign_key :billable_periods, :account_invoices, column: :account_invoice_id
end
end

View File

@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150916012814) do
ActiveRecord::Schema.define(:version => 20150916061809) do
create_table "account_invoices", :force => true do |t|
t.integer "user_id", :null => false
@@ -48,8 +48,11 @@ ActiveRecord::Schema.define(:version => 20150916012814) do
t.datetime "deleted_at"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "account_invoice_id", :null => false
end
add_index "billable_periods", ["account_invoice_id"], :name => "index_billable_periods_on_account_invoice_id"
create_table "carts", :force => true do |t|
t.integer "user_id"
end
@@ -1169,6 +1172,7 @@ ActiveRecord::Schema.define(:version => 20150916012814) do
add_foreign_key "adjustment_metadata", "enterprises", name: "adjustment_metadata_enterprise_id_fk"
add_foreign_key "adjustment_metadata", "spree_adjustments", name: "adjustment_metadata_adjustment_id_fk", column: "adjustment_id", dependent: :delete
add_foreign_key "billable_periods", "account_invoices", name: "billable_periods_account_invoice_id_fk"
add_foreign_key "billable_periods", "enterprises", name: "bill_items_enterprise_id_fk"
add_foreign_key "billable_periods", "spree_users", name: "bill_items_owner_id_fk", column: "owner_id"