Add DeliveryConfigurations for forms to allow sending submissions by multiple methods#2933
Merged
Merged
Conversation
stephencdaly
force-pushed
the
add-delivery-configurations-table
branch
from
July 15, 2026 09:58
a7be648 to
d55c133
Compare
stephencdaly
force-pushed
the
add-delivery-configurations-table
branch
from
July 15, 2026 11:14
d55c133 to
62c250d
Compare
stephencdaly
marked this pull request as ready for review
July 15, 2026 11:22
thomasiles
reviewed
Jul 15, 2026
thomasiles
left a comment
Contributor
There was a problem hiding this comment.
This works for me, nice one 🏅
thomasiles
previously approved these changes
Jul 15, 2026
Contributor
Author
|
@theseanything thanks for the review, I'll make all those changes. |
stephencdaly
force-pushed
the
add-delivery-configurations-table
branch
from
July 15, 2026 17:36
62c250d to
0e6a6f8
Compare
We're adding this table so that we can configure a form to deliver to multiple destinations. The `delivery_method` will be "email" or "s3", and replaces the `submission_type` column on the `forms` table. The `formats` column replaces the `submission_format` column on the `forms` table. The `delivery_schedule`` can be either "immediate", "daily", or "weekly". This matches the delivery_schedules we store in the forms-runner database on the `delivery` table. We will replace the `send_daily_submission_batch` and `send_weekly_submission_batch` columns on the `forms` table by adding extra `delivery_configuration` records for the form with appropriate delivery_schedules. This data model could be further iterated in future to move the `submission_email`, `s3_bucket_name` and other s3 settings to the `delivery_configurations` table. This might lead to some duplication of the configuration settings between different delivery configurations for the same form - i.e. for immediate and daily email deliveries. However, there is a need from users to sometimes send submissions to different or multiple email addresses.
When the submission email is confirmed for a form, create a DeliveryConfiguration with delivery_method set to 'email' and frequency set to 'immediate', if a matching DeliveryConfiguration does not already exist for the form. The presence or not of a DeliveryConfiguration will be used instead of the `submission_type` on the Form to determine whether to send individual submissions by email.
When daily/weekly batch submission emails are are enabled or disabled, create or destroy the appropriate DeliveryConfiguration records for the form. DeliveryConfigurations will replace the `send_daily_submission_batch` and `send_weekly_submission_batch` form attributes.
When csv/json attachments are enabled or disabled for email submissions, update the immediate email DeliveryConfiguration with the new formats.
Update the rake tasks that change the submission type between email and S3 to also add/remove the corresponding DeliveryConfiguration records. We'll need to update these tasks further when we add the ability for both email and S3 immediate delivery to be enabled at the same time, but for now just update them to ensure we keep the DeliveryConfiguration records in sync with the submission type.
The rake task updates all existing forms to have a DeliveryConfiguration with settings from the form's submission_type and submission_format, and additional DeliveryConfigurations if the form has daily or weekly batches enabled. Updates the form documents with delivery_configurations corresponding to the settings on the existing form_document, which might be different to the settings on the form for live and archived form documents.
Delete the existing DeliveryConfigurations for the form and recreate them from the live form document when reverting a draft form.
We already do not copy the submission email when copying a form to require users to make an active decision about where submissions go. To be consistent, also do not copy the s3 bucket configuration when copying a form. We will also not copy the DeliveryConfigurations for a form, so users will need to decide if they want submission emails to include CSV or JSON attachments, and whether they want to receive daily or weekly submission emails.
stephencdaly
force-pushed
the
add-delivery-configurations-table
branch
from
July 16, 2026 12:08
0e6a6f8 to
e492bc6
Compare
|
🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-2933.admin.review.forms.service.gov.uk/ It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready For the sign in details and more information, see the review apps wiki page. |
thomasiles
approved these changes
Jul 16, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this pull request solve?
Trello card: https://trello.com/c/WMnjLlJV/245-allow-both-email-and-s3-submissions-simultaneously
Move the settings that decide where we send a form's submissions to a
delivery_configurationstable, which has a many to one relationship with forms.This will allow for submissions to be sent by both email and to an s3 bucket for the same form.
Also add
DeliveryConfigurationrecords for batch submissions, which are identified by thefrequencycolumn.This PR ensures that appropriate DeliveryConfigurations are created when a form is updated, and adds a data migration rake task to create records for existing forms.
We do not yet consume the DeliveryConfigurations, for example to determine the content to display on the live form page but will do in a subsequent PR once the data migration has been run.
Things to consider when reviewing