Skip to content

Commit

Permalink
ActiveFedora based deletion issues (#986)
Browse files Browse the repository at this point in the history
* AF deletes should free up the id for reuse and file set deletes should only save the parent if the parent exists and is AF

* test cleanup
  • Loading branch information
orangewolf authored Dec 2, 2024
1 parent 77528bf commit 87a3863
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['2.7', '3.0']
ruby: ['2.7', '3.2']
name: Run specs with ruby ${{ matrix.ruby }}
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion app/factories/bulkrax/object_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def find_by_id
end

def delete(_user)
find&.delete
find&.delete(eradicate: true)
end

private
Expand Down
4 changes: 2 additions & 2 deletions app/jobs/bulkrax/delete_file_set_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ def perform(entry, importer_run)
om = parent.ordered_members.to_a
om.delete(file_set)
parent.ordered_members = om
elsif parent.respond_to?(:member_ids)
parent.save
elsif parent&.respond_to?(:member_ids)
parent.member_ids.delete(file_set.id)
Hyrax.persister.save(resource: parent)
end
parent.save
end

super
Expand Down
8 changes: 5 additions & 3 deletions spec/test_app/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.define(version: 2024_03_07_053156) do
ActiveRecord::Schema.define(version: 2024_09_16_182823) do

create_table "accounts", force: :cascade do |t|
t.string "name"
Expand Down Expand Up @@ -101,8 +101,6 @@
t.integer "total_file_set_entries", default: 0
t.integer "processed_works", default: 0
t.integer "failed_works", default: 0
t.integer "processed_children", default: 0
t.integer "failed_children", default: 0
t.index ["importer_id"], name: "index_bulkrax_importer_runs_on_importer_id"
end

Expand All @@ -121,6 +119,8 @@
t.datetime "last_error_at"
t.datetime "last_succeeded_at"
t.string "status_message", default: "Pending"
t.datetime "last_imported_at"
t.datetime "next_import_at"
t.index ["user_id"], name: "index_bulkrax_importers_on_user_id"
end

Expand All @@ -131,6 +131,7 @@
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "order", default: 0
t.string "status_message", default: "Pending"
t.index ["child_id"], name: "index_bulkrax_pending_relationships_on_child_id"
t.index ["importer_run_id"], name: "index_bulkrax_pending_relationships_on_importer_run_id"
t.index ["parent_id"], name: "index_bulkrax_pending_relationships_on_parent_id"
Expand Down Expand Up @@ -581,6 +582,7 @@
t.string "file_set_uri"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "filename"
t.index ["file_set_uri"], name: "index_uploaded_files_on_file_set_uri"
t.index ["user_id"], name: "index_uploaded_files_on_user_id"
end
Expand Down

0 comments on commit 87a3863

Please sign in to comment.