Skip to content

Update FormDocumentSyncService for new unique indexes - #3023

Merged
stephencdaly merged 1 commit into
mainfrom
delete-archived-form-before-making-form-live
Aug 13, 2026
Merged

Update FormDocumentSyncService for new unique indexes#3023
stephencdaly merged 1 commit into
mainfrom
delete-archived-form-before-making-form-live

Conversation

@stephencdaly

@stephencdaly stephencdaly commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

What problem does this pull request solve?

Trello card: https://trello.com/c/dGv0TrD1

We're not yet updating the service to increment the version number when a form goes live.

However, we need to update the service to handle the new unique indexes we want to add that will enforce that there is only one form document per version per language for a form.

Ensure we delete archived form documents before creating a new live form document so we only ever have one live or archived form document per language per form.

We also don't need to handle the case where there is an existing archived form document when archiving a form, as this can never happen and will soon be enforced by the new unique indexes.

I've verified that no existing form has both live and archived form documents for the same language on any environment using the query:

SELECT form_id from form_documents where tag IN ('live', 'archived') group by form_id, language having count(1) > 1;

Things to consider when reviewing

  • Ensure that you consider the wider context.
  • Does it work when run on your machine?
  • Is it clear what the code is doing?
  • Do the commit messages explain why the changes were made?
  • Are there all the unit tests needed?
  • Do the end to end tests need updating before these changes will pass?
  • Has all relevant documentation been updated?

We're not yet updating the service to increment the version number
when a form goes live.

However, we need to update the service to handle the new unique
indexes we want to add that will enforce that there is only one form
document per version per language for a form.

Ensure we delete archived form documents before creating a new live
form document so we only ever have one live or archived form document
per language per form.

We also don't need to handle the case where there is an existing
archived form document when archiving a form, as this can never happen
and will soon be enforced by the new unique indexes.
@github-actions

Copy link
Copy Markdown

🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-3023.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
after 5 minutes, there may be something wrong with the ECS task. You will need to go to the integration AWS account
to debug, or otherwise ask an infrastructure person.

For the sign in details and more information, see the review apps wiki page.

@stephencdaly
stephencdaly added this pull request to the merge queue Aug 13, 2026
Merged via the queue into main with commit d7b877d Aug 13, 2026
6 checks passed
@stephencdaly
stephencdaly deleted the delete-archived-form-before-making-form-live branch August 13, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants