Skip to content

Commit

Permalink
Address good_job notice
Browse files Browse the repository at this point in the history
  • Loading branch information
Earlopain committed Sep 18, 2023
1 parent dcc28df commit 351d50a
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 1 deletion.
33 changes: 33 additions & 0 deletions db/migrate/20230918172046_create_good_job_executions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# frozen_string_literal: true

class CreateGoodJobExecutions < ActiveRecord::Migration[7.0]
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
return if connection.table_exists?(:good_job_executions)
end
end

create_table :good_job_executions, id: :uuid do |t|
t.timestamps

t.uuid :active_job_id, null: false
t.text :job_class
t.text :queue_name
t.jsonb :serialized_params
t.datetime :scheduled_at
t.datetime :finished_at
t.text :error

t.index %i[active_job_id created_at], name: :index_good_job_executions_on_active_job_id_and_created_at
end

change_table :good_jobs do |t| # rubocop:disable Rails/BulkChangeTable
t.boolean :is_discrete # rubocop:disable Rails/ThreeStateBooleanColumn
t.integer :executions_count
t.text :job_class
end
end
end
16 changes: 16 additions & 0 deletions db/migrate/20230918172047_create_good_jobs_error_event.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

class CreateGoodJobsErrorEvent < ActiveRecord::Migration[7.0]
def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
return if connection.column_exists?(:good_jobs, :error_event)
end
end

add_column :good_jobs, :error_event, :integer, limit: 2
add_column :good_job_executions, :error_event, :integer, limit: 2
end
end
20 changes: 19 additions & 1 deletion 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[7.0].define(version: 2023_02_10_082852) do
ActiveRecord::Schema[7.0].define(version: 2023_09_18_172047) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"
Expand Down Expand Up @@ -109,6 +109,20 @@
t.datetime "finished_at"
end

create_table "good_job_executions", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.uuid "active_job_id", null: false
t.text "job_class"
t.text "queue_name"
t.jsonb "serialized_params"
t.datetime "scheduled_at"
t.datetime "finished_at"
t.text "error"
t.integer "error_event", limit: 2
t.index ["active_job_id", "created_at"], name: "index_good_job_executions_on_active_job_id_and_created_at"
end

create_table "good_job_processes", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
Expand Down Expand Up @@ -140,6 +154,10 @@
t.datetime "cron_at"
t.uuid "batch_id"
t.uuid "batch_callback_id"
t.boolean "is_discrete"
t.integer "executions_count"
t.text "job_class"
t.integer "error_event", limit: 2
t.index ["active_job_id", "created_at"], name: "index_good_jobs_on_active_job_id_and_created_at"
t.index ["active_job_id"], name: "index_good_jobs_on_active_job_id"
t.index ["batch_callback_id"], name: "index_good_jobs_on_batch_callback_id", where: "(batch_callback_id IS NOT NULL)"
Expand Down

0 comments on commit 351d50a

Please sign in to comment.