From 4a8f9d1e367fb31af45ed387f578f594891db7dd Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Wed, 16 Sep 2015 16:31:28 +1000 Subject: [PATCH] Adding reference to account_invoice for each billable_period --- ...150916061809_add_account_invoice_to_billable_periods.rb | 7 +++++++ db/schema.rb | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20150916061809_add_account_invoice_to_billable_periods.rb diff --git a/db/migrate/20150916061809_add_account_invoice_to_billable_periods.rb b/db/migrate/20150916061809_add_account_invoice_to_billable_periods.rb new file mode 100644 index 0000000000..ee1d9d5d93 --- /dev/null +++ b/db/migrate/20150916061809_add_account_invoice_to_billable_periods.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 2cb9b20a0d..a305037ed2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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"