From ddb10eac9e8a3040dbfad576c3f60f1d4c70a4cc Mon Sep 17 00:00:00 2001 From: Satoshi Matsumoto Date: Thu, 27 Apr 2017 18:34:40 +0900 Subject: [PATCH] Fix job not being recorded as completed when exit status > 127 Kuroko would fail to record the completion of the job when it exits with status bigger than 127 as it causes an ActiveModel::RangeError. --- db/migrate/028_change_exit_status_to_unsigned_tinyint.rb | 9 +++++++++ spec/dummy/db/schema.rb | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 db/migrate/028_change_exit_status_to_unsigned_tinyint.rb diff --git a/db/migrate/028_change_exit_status_to_unsigned_tinyint.rb b/db/migrate/028_change_exit_status_to_unsigned_tinyint.rb new file mode 100644 index 00000000..40c63854 --- /dev/null +++ b/db/migrate/028_change_exit_status_to_unsigned_tinyint.rb @@ -0,0 +1,9 @@ +class ChangeExitStatusToUnsignedTinyint < ActiveRecord::Migration + def up + change_column :executions, :exit_status, 'tinyint(4) unsigned' + end + + def down + change_column :executions, :exit_status, :integer, limit: 1 + end +end diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb index eae7b78e..b574770a 100644 --- a/spec/dummy/db/schema.rb +++ b/spec/dummy/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 27) do +ActiveRecord::Schema.define(version: 28) do create_table "admin_assignments", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t| t.integer "user_id", null: false @@ -31,7 +31,7 @@ t.text "context", limit: 65535, null: false t.integer "pid" t.text "output", limit: 4294967295 - t.integer "exit_status", limit: 1 + t.integer "exit_status", limit: 1, unsigned: true t.integer "term_signal", limit: 1 t.datetime "started_at" t.datetime "finished_at"