diff options
| author | jpl | 2017-02-14 17:12:46 +0100 |
|---|---|---|
| committer | jpl | 2017-02-14 17:12:46 +0100 |
| commit | 5fbfc7f87bcae3fdccedbbbf8cb5134fd592ed50 (patch) | |
| tree | 308ece560a13fb0f41469eebd4e52b7ee3265fec /db | |
| parent | a9b42b07109ba40045e06e5e9a6c7564004d574c (diff) | |
| download | chouette-core-5fbfc7f87bcae3fdccedbbbf8cb5134fd592ed50.tar.bz2 | |
Fix stuff, featuring Alban Peigner
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrate/20170213135212_add_timestamps_to_some_models.rb | 15 | ||||
| -rw-r--r-- | db/schema.rb | 20 |
2 files changed, 30 insertions, 5 deletions
diff --git a/db/migrate/20170213135212_add_timestamps_to_some_models.rb b/db/migrate/20170213135212_add_timestamps_to_some_models.rb index 1502975fe..c9fdb1d54 100644 --- a/db/migrate/20170213135212_add_timestamps_to_some_models.rb +++ b/db/migrate/20170213135212_add_timestamps_to_some_models.rb @@ -1,14 +1,21 @@ class AddTimestampsToSomeModels < ActiveRecord::Migration - def change + def up models = %i(vehicle_journeys timebands time_tables stop_points stop_areas routing_constraint_zones routes route_sections pt_links networks lines journey_patterns group_of_lines connection_links companies access_points access_links) models.each do |table| - if !column_exists?(table, :created_at) && column_exists?(table, :creation_time) + unless column_exists?(table, :created_at) add_timestamps table - Object.const_get("Chouette::#{table.to_s.classify}").update_all 'created_at = creation_time' end - remove_column table, :creation_time if column_exists?(table, :creation_time) + + if column_exists?(table, :creation_time) + execute "update #{table} set created_at = creation_time" + remove_column table, :creation_time + end end end + + def down + + end end diff --git a/db/schema.rb b/db/schema.rb index 2a1c0334c..f6327e3b7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170213163747) do +ActiveRecord::Schema.define(version: 20170213135212) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -165,6 +165,22 @@ ActiveRecord::Schema.define(version: 20170213163747) do add_index "connection_links", ["objectid"], :name => "connection_links_objectid_key", :unique => true + create_table "delayed_jobs", force: true do |t| + t.integer "priority", default: 0 + t.integer "attempts", default: 0 + t.text "handler" + t.text "last_error" + t.datetime "run_at" + t.datetime "locked_at" + t.datetime "failed_at" + t.string "locked_by" + t.string "queue" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" + create_table "exports", force: true do |t| t.integer "referential_id", limit: 8 t.string "status" @@ -778,6 +794,8 @@ ActiveRecord::Schema.define(version: 20170213163747) do add_index "workbenches", ["stop_area_referential_id"], :name => "index_workbenches_on_stop_area_referential_id" Foreigner.load + add_foreign_key "access_links", "access_points", name: "aclk_acpt_fkey", dependent: :delete + add_foreign_key "group_of_lines_lines", "group_of_lines", name: "groupofline_group_fkey", dependent: :delete add_foreign_key "journey_frequencies", "timebands", name: "journey_frequencies_timeband_id_fk", dependent: :nullify |
