X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/ccff8ce154b393512dd4b563853f63a9abeefba4..3facf89bf048487ee718fe15d012b489f2d407b7:/services/api/db/migrate/20140918153705_add_state_to_job.rb?ds=sidebyside diff --git a/services/api/db/migrate/20140918153705_add_state_to_job.rb b/services/api/db/migrate/20140918153705_add_state_to_job.rb index 7b595a36cd..46a5e84362 100644 --- a/services/api/db/migrate/20140918153705_add_state_to_job.rb +++ b/services/api/db/migrate/20140918153705_add_state_to_job.rb @@ -1,4 +1,8 @@ -class AddStateToJob < ActiveRecord::Migration +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + +class AddStateToJob < ActiveRecord::Migration[4.2] include CurrentApiClient def up @@ -9,6 +13,8 @@ class AddStateToJob < ActiveRecord::Migration Job.update_all({state: 'Failed'}, ['state is null and success = ?', false]) Job.update_all({state: 'Complete'}, ['state is null and success = ?', true]) Job.update_all({state: 'Running'}, ['state is null and running = ?', true]) + # Locked/started, but not Running/Failed/Complete? Let's assume it failed. + Job.update_all({state: 'Failed'}, ['state is null and (is_locked_by_uuid is not null or started_at is not null)']) Job.update_all({state: 'Queued'}, ['state is null']) end end