Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

document how file_links are deleted when storages are deleted

Christophe Bliardcfd1b0cc54b4
diff --git a/modules/storages/app/models/storages/storage.rb b/modules/storages/app/models/storages/storage.rb
index 669cd1da8df..c51d09882e9 100644
--- a/modules/storages/app/models/storages/storage.rb
+++ b/modules/storages/app/models/storages/storage.rb
@@ -37,7 +37,13 @@
# Additional attributes and constraints are defined in
# db/migrate/20220113144323_create_storage.rb "migration".
class Storages::Storage < ApplicationRecord
- # One Storage can have multiple FileLinks, representing external files
+ # One Storage can have multiple FileLinks, representing external files.
+ #
+ # FileLink deletion is done:
+ # - through a on_delete: :cascade at the database level when deleting a
+ # Storage
+ # - through a before_destroy hook at the application level when deleting a
+ # ProjectStorage
has_many :file_links, class_name: 'Storages::FileLink'
# Basically every OpenProject object has a creator
belongs_to :creator, class_name: 'User'