aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20171215144543_rename_business_calendars_to_purchase_windows.rb5
-rw-r--r--db/migrate/20171215145023_update_purchase_windows_attributes.rb13
-rw-r--r--db/schema.rb27
3 files changed, 32 insertions, 13 deletions
diff --git a/db/migrate/20171215144543_rename_business_calendars_to_purchase_windows.rb b/db/migrate/20171215144543_rename_business_calendars_to_purchase_windows.rb
new file mode 100644
index 000000000..d4467d6a7
--- /dev/null
+++ b/db/migrate/20171215144543_rename_business_calendars_to_purchase_windows.rb
@@ -0,0 +1,5 @@
+class RenameBusinessCalendarsToPurchaseWindows < ActiveRecord::Migration
+ def change
+ rename_table :business_calendars, :purchase_windows
+ end
+end
diff --git a/db/migrate/20171215145023_update_purchase_windows_attributes.rb b/db/migrate/20171215145023_update_purchase_windows_attributes.rb
new file mode 100644
index 000000000..48dfb15bc
--- /dev/null
+++ b/db/migrate/20171215145023_update_purchase_windows_attributes.rb
@@ -0,0 +1,13 @@
+class UpdatePurchaseWindowsAttributes < ActiveRecord::Migration
+ def change
+ add_column :purchase_windows, :objectid, :string
+ add_column :purchase_windows, :checksum, :string
+ add_column :purchase_windows, :checksum_source, :text
+
+ remove_column :purchase_windows, :short_name, :string
+ remove_column :purchase_windows, :dates, :date
+ remove_column :purchase_windows, :organisation_id, :integer
+
+ add_reference :purchase_windows, :referential, type: :bigint, index: true
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index faf7f3a1e..ef1e404b4 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -81,19 +81,6 @@ ActiveRecord::Schema.define(version: 20171214130636) do
add_index "api_keys", ["organisation_id"], name: "index_api_keys_on_organisation_id", using: :btree
- create_table "business_calendars", id: :bigserial, force: :cascade do |t|
- t.string "name"
- t.string "short_name"
- t.string "color"
- t.daterange "date_ranges", array: true
- t.date "dates", array: true
- t.integer "organisation_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
-
- add_index "business_calendars", ["organisation_id"], name: "index_business_calendars_on_organisation_id", using: :btree
-
create_table "calendars", id: :bigserial, force: :cascade do |t|
t.string "name"
t.string "short_name"
@@ -584,6 +571,20 @@ ActiveRecord::Schema.define(version: 20171214130636) do
add_index "pt_links", ["objectid"], name: "pt_links_objectid_key", unique: true, using: :btree
+ create_table "purchase_windows", id: :bigserial, force: :cascade do |t|
+ t.string "name"
+ t.string "color"
+ t.daterange "date_ranges", array: true
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.string "objectid"
+ t.string "checksum"
+ t.text "checksum_source"
+ t.integer "referential_id", limit: 8
+ end
+
+ add_index "purchase_windows", ["referential_id"], name: "index_purchase_windows_on_referential_id", using: :btree
+
create_table "referential_clonings", id: :bigserial, force: :cascade do |t|
t.string "status"
t.datetime "started_at"