diff --git a/app/jobs/govbox/sync_all_boxes_job.rb b/app/jobs/govbox/sync_all_boxes_job.rb index 98e8b970d..201047ccf 100644 --- a/app/jobs/govbox/sync_all_boxes_job.rb +++ b/app/jobs/govbox/sync_all_boxes_job.rb @@ -4,7 +4,7 @@ class SyncAllBoxesJob < ApplicationJob def perform Box.find_each do |box| - SyncBoxJob.perform_later(box) + SyncBoxJob.perform_later(box) if box.syncable? end end end diff --git a/app/models/box.rb b/app/models/box.rb index 8f017d420..bf6c09b44 100644 --- a/app/models/box.rb +++ b/app/models/box.rb @@ -6,6 +6,7 @@ # tenant_id :integer not null # name :string not null # uri :string +# syncable :boolean not null, default: true # created_at :datetime not null # updated_at :datetime not null diff --git a/db/migrate/20230907123137_add_syncable_flag_to_boxes.rb b/db/migrate/20230907123137_add_syncable_flag_to_boxes.rb new file mode 100644 index 000000000..2cf099b37 --- /dev/null +++ b/db/migrate/20230907123137_add_syncable_flag_to_boxes.rb @@ -0,0 +1,5 @@ +class AddSyncableFlagToBoxes < ActiveRecord::Migration[7.0] + def change + add_column :boxes, :syncable, :boolean, null: false, default: true + end +end diff --git a/db/schema.rb b/db/schema.rb index a15fa814d..1e796c945 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_05_100110) do +ActiveRecord::Schema[7.0].define(version: 2023_09_07_123137) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -83,6 +83,7 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.bigint "tenant_id", null: false + t.boolean "syncable", default: true, null: false t.index ["tenant_id"], name: "index_boxes_on_tenant_id" end