-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move DataExport CSV data into Active Storage #9409
Move DataExport CSV data into Active Storage #9409
Conversation
fab851c
to
0c1c121
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't wanna to be picky but:
Is it possible to separate into multiples PRs? (DB migration/ERD, data migrations/code?)
Can we add documentation to the AKS cheatsheet about how to access the azure storage/buckets file, troubleshooting, etc?
28f6c39
to
5ca08d3
Compare
0c1c121
to
daa2870
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍 makes life much easier 🚀
@@ -48,7 +48,8 @@ def create | |||
def download | |||
data_export = DataExport.find(params[:id]) | |||
data_export.update!(audit_comment: 'File downloaded') | |||
send_data data_export.data, filename: data_export.filename, disposition: :attachment | |||
|
|||
redirect_to rails_blob_path(data_export.file, disposition: 'attachment') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check if data_export.file.attached?
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a slightly separate approach here. If the file doesn't exist, the .find
call will fail.
35c4782
to
f92e524
Compare
daa2870
to
e0478de
Compare
Migrate previous `DataExport#data` values into `DataExport#file`. Start populating the CSV content into the `DataExport#file` field via the `DataExporter` class calls.
e0478de
to
4b0a386
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great 🚀
Context
We want to reduce the size of the
data_exports
table rows. They are currently storing the CSV contents in the database itself in binary form.Changes proposed in this pull request
DataExport
csv data in thedata
attribute into thefile
attachment.data_exports#download
controller action to download from Azure.Guidance to review
Locally
AZURE_STORAGE_ACCOUNT_NAME
,AZURE_STORAGE_ACCESS_KEY
, andAZURE_STORAGE_CONTAINER_NAME
environment variables accordingly.Documentation
Link to Trello card
https://trello.com/c/AS6YvTve/1342-bug-apply-db-backups-intermittently-failing
Things to check