diff options
| author | Vlatka Pavisic | 2017-03-07 17:08:33 +0100 |
|---|---|---|
| committer | Vlatka Pavisic | 2017-03-07 17:08:33 +0100 |
| commit | 35941d9135b33b18a1cfc1463838cfc932c71b13 (patch) | |
| tree | ef9da959fbf662f0241ea3e291ff855aa86b4886 | |
| parent | 69bdfe7a7fdb4dffda3d58becbc1c4c2c2ffff22 (diff) | |
| download | chouette-core-35941d9135b33b18a1cfc1463838cfc932c71b13.tar.bz2 | |
Refs #2596 : Set updated_at for modied tables
| -rw-r--r-- | db/migrate/20170307155042_set_updated_at.rb | 14 | ||||
| -rw-r--r-- | db/schema.rb | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/db/migrate/20170307155042_set_updated_at.rb b/db/migrate/20170307155042_set_updated_at.rb new file mode 100644 index 000000000..84ffd8211 --- /dev/null +++ b/db/migrate/20170307155042_set_updated_at.rb @@ -0,0 +1,14 @@ +class SetUpdatedAt < ActiveRecord::Migration + def up + models = %w(VehicleJourney Timeband TimeTable StopPoint StopArea RoutingConstraintZone Route RouteSection PtLink Network Line + JourneyPattern GroupOfLine ConnectionLink Company AccessPoint AccessLink) + + models.each do |table| + "Chouette::#{table}".constantize.where(updated_at: nil).update_all('updated_at = created_at') + end + + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 6ee6bb4ea..28db2ce89 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: 20170301170956) do +ActiveRecord::Schema.define(version: 20170307155042) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" |
