Skip to content

Commit

Permalink
Populate archived_at field on devices for archived devices
Browse files Browse the repository at this point in the history
This corrects an oversight in my previous PR which created the field but didn't set it for previously-archived devices.
  • Loading branch information
timcowlishaw committed Jul 5, 2023
1 parent 6c768e3 commit 8c45768
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class PopulateDeviceArchivedAtColumn < ActiveRecord::Migration[6.0]
def change
execute %{
UPDATE devices
SET archived_at = NOW()
WHERE workflow_state = 'archived'
}
end
end
6 changes: 3 additions & 3 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2023_05_12_075843) do
ActiveRecord::Schema.define(version: 2023_07_05_095430) do

# These are extensions that must be enabled in order to support this database
enable_extension "adminpack"
Expand Down Expand Up @@ -89,8 +89,8 @@
t.string "state"
t.string "device_token"
t.jsonb "hardware_info"
t.datetime "notify_stopped_publishing_timestamp", default: "2019-01-16 16:19:35"
t.datetime "notify_low_battery_timestamp", default: "2019-01-16 16:19:35"
t.datetime "notify_stopped_publishing_timestamp", default: "2019-01-21 16:07:41"
t.datetime "notify_low_battery_timestamp", default: "2019-01-21 16:07:41"
t.boolean "notify_low_battery", default: false
t.boolean "notify_stopped_publishing", default: false
t.boolean "is_private", default: false
Expand Down

0 comments on commit 8c45768

Please sign in to comment.