Skip to content

Plan migration of existing CarrierWave attachments to ActiveStorage #7796

@entantoencuanto

Description

@entantoencuanto

The current existing attachments should be moved to ActiveStorage. There are some differences between both systems, one of the most important is the use of variations defined in CarrierWave uploaders for miaga:

  • CarrierWave process and uploads a variation file for each one defined in the uploader and ActiveStorage allows us to define variants but they are created and cached when the variant is requested to the application, so the migration should download only a version of the images (the version with better quality) and upload it with AS
  • The CarrierWave uploaders define default paths for uploads including the id of the instance with attachment, but in AS the blob path is calculated automatically and the only option is to define a custom path for each model by defining a custom uploader service but it doesn't make much sense. I'd store all AS files in the same service.
  • A process should be created to verify that all attachments has been created and compare the files to check that nothing has changed
  • Remove dependencies with CarrierWave:
    • Create a task to remove each file associated wit old uploaders mounting them in classes and calling the item.remove_attachment_name! and item.save methods on each instance of the model
    • Add a migration to remove all columns associated with CarrierWave attachments
    • Change Decidim::ApplicationUploader class to not inherit from CarrierWave and add a initialize method to store internally the model and mounted_as attributes
    • Remove gem dependency
  • Generate step by step documentation to make the migration of files before remove dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions