-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6906 from ministryofjustice/ap-5141/partner-file-…
…lengths AP-5141: Change partner file name lengths
- Loading branch information
Showing
27 changed files
with
282 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
app/views/providers/means/check_income_answers/_partner_income_assessment.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
namespace :migrate do | ||
desc "AP-5141 migrate attachment names after length exceeded CCMS limits" | ||
|
||
task partner_attachments: :environment do | ||
changes = { | ||
partner_bank_statement_evidence: "part_bank_state_evidence", | ||
partner_bank_statement_evidence_pdf: "part_bank_state_evidence_pdf", | ||
partner_employment_evidence: "part_employ_evidence", | ||
partner_employment_evidence_pdf: "part_employ_evidence_pdf", | ||
} | ||
|
||
attachments = Attachment.where(attachment_type: changes.keys) | ||
documents = CCMS::SubmissionDocument.where(document_type: changes.keys) | ||
Rails.logger.info "Migrating filenames" | ||
Rails.logger.info "----------------------------------------" | ||
Rails.logger.info "Affected attachments : #{attachments.count}" | ||
Rails.logger.info "Affected documents : #{documents.count}" | ||
Rails.logger.info "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" | ||
Benchmark.benchmark do |bm| | ||
bm.report("Migrate:") do | ||
ActiveRecord::Base.transaction do | ||
attachments.each do |file| | ||
file.attachment_type = changes[file.attachment_type.to_sym] | ||
file.save!(touch: false) # this prevents the updated_at date being changed and delaying purging of stale records | ||
end | ||
raise StandardError, "Not all attachments updated" if Attachment.where(attachment_type: changes.keys).count.positive? | ||
|
||
documents.each do |file| | ||
file.document_type = changes[file.document_type.to_sym] | ||
file.save!(touch: false) # this prevents the updated_at date being changed and delaying purging of stale records | ||
end | ||
raise StandardError, "Not all documents updated" if CCMS::SubmissionDocument.where(document_type: changes.keys).count.positive? | ||
end | ||
end | ||
end | ||
Rails.logger.info "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" | ||
Rails.logger.info "Attachments updated : #{Attachment.where(attachment_type: changes.values).count}" | ||
Rails.logger.info "Documents updated : #{CCMS::SubmissionDocument.where(document_type: changes.values).count}" | ||
Rails.logger.info "Attachments not updated: #{Attachment.where(attachment_type: changes.keys).count}" | ||
Rails.logger.info "Documents not updated : #{CCMS::SubmissionDocument.where(document_type: changes.keys).count}" | ||
Rails.logger.info "----------------------------------------" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.