From 8fa87c5225584e807bc81fb6b597aae7fd4c0260 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 17 Dec 2023 10:45:25 +0100 Subject: [PATCH] Bump good_job from 3.21.2 to 3.21.5 (#517) * Bump good_job from 3.21.2 to 3.21.5 Bumps [good_job](https://github.com/bensheldon/good_job) from 3.21.2 to 3.21.5. - [Release notes](https://github.com/bensheldon/good_job/releases) - [Changelog](https://github.com/bensheldon/good_job/blob/main/CHANGELOG.md) - [Commits](https://github.com/bensheldon/good_job/compare/v3.21.2...v3.21.5) --- updated-dependencies: - dependency-name: good_job dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Update gemset.nix * Add and run migrations --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] Co-authored-by: Charlotte Van Petegem --- Gemfile.lock | 4 +- config/routes.rb | 1 + ...20231217094200_create_good_job_settings.rb | 20 +++++++++ ..._on_priority_created_at_when_unfinished.rb | 19 ++++++++ .../20231217094202_create_good_job_batches.rb | 35 +++++++++++++++ ...231217094203_create_good_job_executions.rb | 33 ++++++++++++++ ...1217094204_create_good_jobs_error_event.rb | 16 +++++++ ..._good_job_cron_indexes_with_conditional.rb | 45 +++++++++++++++++++ db/schema.rb | 6 +-- gemset.nix | 8 ++-- 10 files changed, 178 insertions(+), 9 deletions(-) create mode 100644 db/migrate/20231217094200_create_good_job_settings.rb create mode 100644 db/migrate/20231217094201_create_index_good_jobs_jobs_on_priority_created_at_when_unfinished.rb create mode 100644 db/migrate/20231217094202_create_good_job_batches.rb create mode 100644 db/migrate/20231217094203_create_good_job_executions.rb create mode 100644 db/migrate/20231217094204_create_good_jobs_error_event.rb create mode 100644 db/migrate/20231217094205_recreate_good_job_cron_indexes_with_conditional.rb diff --git a/Gemfile.lock b/Gemfile.lock index 4177ba77..743bd7bd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -86,7 +86,7 @@ GEM ast (2.4.2) base64 (0.2.0) bcrypt (3.1.20) - bigdecimal (3.1.4) + bigdecimal (3.1.5) bootsnap (1.17.0) msgpack (~> 1.2) builder (3.2.4) @@ -120,7 +120,7 @@ GEM raabro (~> 1.4) globalid (1.2.1) activesupport (>= 6.1) - good_job (3.21.2) + good_job (3.21.5) activejob (>= 6.0.0) activerecord (>= 6.0.0) concurrent-ruby (>= 1.0.2) diff --git a/config/routes.rb b/config/routes.rb index bdbcc522..2b66f161 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -77,6 +77,7 @@ # POST /api/plays(.:format) plays#create # destroy_empty_tracks POST /api/tracks/destroy_empty(.:format) tracks#destroy_empty # audio_track GET /api/tracks/:id/audio(.:format) tracks#audio +# download_track GET /api/tracks/:id/download(.:format) tracks#download # merge_track POST /api/tracks/:id/merge(.:format) tracks#merge # tracks GET /api/tracks(.:format) tracks#index # POST /api/tracks(.:format) tracks#create diff --git a/db/migrate/20231217094200_create_good_job_settings.rb b/db/migrate/20231217094200_create_good_job_settings.rb new file mode 100644 index 00000000..c75c2983 --- /dev/null +++ b/db/migrate/20231217094200_create_good_job_settings.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class CreateGoodJobSettings < ActiveRecord::Migration[7.1] + 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_settings) + end + end + + create_table :good_job_settings, id: :uuid do |t| + t.timestamps + t.text :key + t.jsonb :value + t.index :key, unique: true + end + end +end diff --git a/db/migrate/20231217094201_create_index_good_jobs_jobs_on_priority_created_at_when_unfinished.rb b/db/migrate/20231217094201_create_index_good_jobs_jobs_on_priority_created_at_when_unfinished.rb new file mode 100644 index 00000000..158dc8f9 --- /dev/null +++ b/db/migrate/20231217094201_create_index_good_jobs_jobs_on_priority_created_at_when_unfinished.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class CreateIndexGoodJobsJobsOnPriorityCreatedAtWhenUnfinished < ActiveRecord::Migration[7.1] + disable_ddl_transaction! + + def change + reversible do |dir| + dir.up do + # Ensure this incremental update migration is idempotent + # with monolithic install migration. + return if connection.index_name_exists?(:good_jobs, :index_good_jobs_jobs_on_priority_created_at_when_unfinished) + end + end + + add_index :good_jobs, [:priority, :created_at], order: { priority: "DESC NULLS LAST", created_at: :asc }, + where: "finished_at IS NULL", name: :index_good_jobs_jobs_on_priority_created_at_when_unfinished, + algorithm: :concurrently + end +end diff --git a/db/migrate/20231217094202_create_good_job_batches.rb b/db/migrate/20231217094202_create_good_job_batches.rb new file mode 100644 index 00000000..ceea2a53 --- /dev/null +++ b/db/migrate/20231217094202_create_good_job_batches.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +class CreateGoodJobBatches < ActiveRecord::Migration[7.1] + 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_batches) + end + end + + create_table :good_job_batches, id: :uuid do |t| + t.timestamps + t.text :description + t.jsonb :serialized_properties + t.text :on_finish + t.text :on_success + t.text :on_discard + t.text :callback_queue_name + t.integer :callback_priority + t.datetime :enqueued_at + t.datetime :discarded_at + t.datetime :finished_at + end + + change_table :good_jobs do |t| + t.uuid :batch_id + t.uuid :batch_callback_id + + t.index :batch_id, where: "batch_id IS NOT NULL" + t.index :batch_callback_id, where: "batch_callback_id IS NOT NULL" + end + end +end diff --git a/db/migrate/20231217094203_create_good_job_executions.rb b/db/migrate/20231217094203_create_good_job_executions.rb new file mode 100644 index 00000000..84a15e22 --- /dev/null +++ b/db/migrate/20231217094203_create_good_job_executions.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +class CreateGoodJobExecutions < ActiveRecord::Migration[7.1] + 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 [:active_job_id, :created_at], name: :index_good_job_executions_on_active_job_id_and_created_at + end + + change_table :good_jobs do |t| + t.boolean :is_discrete + t.integer :executions_count + t.text :job_class + end + end +end diff --git a/db/migrate/20231217094204_create_good_jobs_error_event.rb b/db/migrate/20231217094204_create_good_jobs_error_event.rb new file mode 100644 index 00000000..e301ad75 --- /dev/null +++ b/db/migrate/20231217094204_create_good_jobs_error_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class CreateGoodJobsErrorEvent < ActiveRecord::Migration[7.1] + 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 diff --git a/db/migrate/20231217094205_recreate_good_job_cron_indexes_with_conditional.rb b/db/migrate/20231217094205_recreate_good_job_cron_indexes_with_conditional.rb new file mode 100644 index 00000000..56cab35c --- /dev/null +++ b/db/migrate/20231217094205_recreate_good_job_cron_indexes_with_conditional.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +class RecreateGoodJobCronIndexesWithConditional < ActiveRecord::Migration[7.1] + disable_ddl_transaction! + + def change + reversible do |dir| + dir.up do + unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_cron_key_and_created_at_cond) + add_index :good_jobs, [:cron_key, :created_at], where: "(cron_key IS NOT NULL)", + name: :index_good_jobs_on_cron_key_and_created_at_cond, algorithm: :concurrently + end + unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_cron_key_and_cron_at_cond) + add_index :good_jobs, [:cron_key, :cron_at], where: "(cron_key IS NOT NULL)", unique: true, + name: :index_good_jobs_on_cron_key_and_cron_at_cond, algorithm: :concurrently + end + + if connection.index_name_exists?(:good_jobs, :index_good_jobs_on_cron_key_and_created_at) + remove_index :good_jobs, name: :index_good_jobs_on_cron_key_and_created_at + end + if connection.index_name_exists?(:good_jobs, :index_good_jobs_on_cron_key_and_cron_at) + remove_index :good_jobs, name: :index_good_jobs_on_cron_key_and_cron_at + end + end + + dir.down do + unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_cron_key_and_created_at) + add_index :good_jobs, [:cron_key, :created_at], + name: :index_good_jobs_on_cron_key_and_created_at, algorithm: :concurrently + end + unless connection.index_name_exists?(:good_jobs, :index_good_jobs_on_cron_key_and_cron_at) + add_index :good_jobs, [:cron_key, :cron_at], unique: true, + name: :index_good_jobs_on_cron_key_and_cron_at, algorithm: :concurrently + end + + if connection.index_name_exists?(:good_jobs, :index_good_jobs_on_cron_key_and_created_at_cond) + remove_index :good_jobs, name: :index_good_jobs_on_cron_key_and_created_at_cond + end + if connection.index_name_exists?(:good_jobs, :index_good_jobs_on_cron_key_and_cron_at_cond) + remove_index :good_jobs, name: :index_good_jobs_on_cron_key_and_cron_at_cond + end + end + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 6796e0da..4d40d3f6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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_09_10_071837) do +ActiveRecord::Schema[7.1].define(version: 2023_12_17_094205) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -223,8 +223,8 @@ t.index ["batch_callback_id"], name: "index_good_jobs_on_batch_callback_id", where: "(batch_callback_id IS NOT NULL)" t.index ["batch_id"], name: "index_good_jobs_on_batch_id", where: "(batch_id IS NOT NULL)" t.index ["concurrency_key"], name: "index_good_jobs_on_concurrency_key_when_unfinished", where: "(finished_at IS NULL)" - t.index ["cron_key", "created_at"], name: "index_good_jobs_on_cron_key_and_created_at" - t.index ["cron_key", "cron_at"], name: "index_good_jobs_on_cron_key_and_cron_at", unique: true + t.index ["cron_key", "created_at"], name: "index_good_jobs_on_cron_key_and_created_at_cond", where: "(cron_key IS NOT NULL)" + t.index ["cron_key", "cron_at"], name: "index_good_jobs_on_cron_key_and_cron_at_cond", unique: true, where: "(cron_key IS NOT NULL)" t.index ["finished_at"], name: "index_good_jobs_jobs_on_finished_at", where: "((retried_good_job_id IS NULL) AND (finished_at IS NOT NULL))" t.index ["priority", "created_at"], name: "index_good_jobs_jobs_on_priority_created_at_when_unfinished", order: { priority: "DESC NULLS LAST" }, where: "(finished_at IS NULL)" t.index ["queue_name", "scheduled_at"], name: "index_good_jobs_on_queue_name_and_scheduled_at", where: "(finished_at IS NULL)" diff --git a/gemset.nix b/gemset.nix index 2541ffa6..cb21d0d4 100644 --- a/gemset.nix +++ b/gemset.nix @@ -177,10 +177,10 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "07y615s8yldk3k13lmkhpk1k190lcqvmxmnjwgh4bzjan9xrc36y"; + sha256 = "1b1gqa90amazwnll9590m5ighywh9sacsmpyd5ihljivmvjswksk"; type = "gem"; }; - version = "3.1.4"; + version = "3.1.5"; }; bootsnap = { dependencies = ["msgpack"]; @@ -389,10 +389,10 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "11bkx94qmirl4xda4p9bkzif17nz5ahs864rnq37n0hz88wp0p9w"; + sha256 = "1lqj6mpf14qia3np44y3bp9266ijlyly7zk8p6s0cqq3ngn5vjm1"; type = "gem"; }; - version = "3.21.2"; + version = "3.21.5"; }; has_scope = { dependencies = ["actionpack" "activesupport"];