foodcoops / foodsoft

Web-based software to manage a non-profit food coop (product catalog, ordering, accounting, job scheduling).
https://foodcoops.net/
Other
318 stars 146 forks source link

1037 migrate invoice attachments to active storage slow performance financial links #1039

Closed yksflip closed 5 months ago

yksflip commented 6 months ago

Until now invoice attachments were stored in the database directly, this led to performance issues see #1037. This PR migrates the invoice attachments to use active storage. Additionally multiple attachments are now supported, a small preview is rendered and the delete flow was adapted.

fixes #1037

Screenshot from 2024-02-10 17-06-02 Screenshot from 2024-02-10 17-05-41 Screenshot from 2024-02-10 17-05-50

lentschi commented 5 months ago

@yksflip Code looks good to me :+1: Though I do have to admit I haven't tried it out and I wonder why #1037 is happening in the first place: The fact that attachments are stored in the same db table alone shouldn't cause any performance issues, should it? Maybe this could have been solved by adding attachment_data to the ignored_columns and only load that field whenever we really want to deliver the file contents...?

Anyhow, moving it to active storage is much cleaner :+1:

yksflip commented 5 months ago

thx for reviewing! Ah I see, yeah maybe I concluded a bit too quickly, that might have been enough to resolve the issue.