Skip to content

Change unique indexes for form documents to allow for multiple versions - #3021

Open
stephencdaly wants to merge 3 commits into
mainfrom
change-unique-indexes-for-form-documents
Open

Change unique indexes for form documents to allow for multiple versions#3021
stephencdaly wants to merge 3 commits into
mainfrom
change-unique-indexes-for-form-documents

Conversation

@stephencdaly

Copy link
Copy Markdown
Contributor

What problem does this pull request solve?

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

Update the unique indexes for form documents so that:

  • There can only be form document with a given version per language per form
  • There can only be one form document with a null version per language per form, which accounts for draft form documents

A migration has already been run on all environments to set the version for live and archived form documents to 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?

@stephencdaly
stephencdaly force-pushed the change-unique-indexes-for-form-documents branch 2 times, most recently from ff263af to 9ae8d85 Compare August 13, 2026 13:29
@stephencdaly
stephencdaly marked this pull request as ready for review August 13, 2026 13:39
@stephencdaly stephencdaly changed the title Change unique indexes for form documents Change unique indexes for form documents to allow for multiple versions Aug 13, 2026
@stephencdaly
stephencdaly marked this pull request as draft August 13, 2026 13:50
@stephencdaly
stephencdaly force-pushed the change-unique-indexes-for-form-documents branch from 9ae8d85 to b4ada4b Compare August 13, 2026 14:44
Allow:
- One form_document with the same language and version per form
- One form_document with the same language and a null version per form
to account for draft forms
Delete the tests for the data migration rake task to backfill versons
as the new indexes do not allow for multiple form_documents with the
same language and a null version per form. This rake task has been run
in all environments - but we'll keep it around slightly longer so devs
can run it if they need to backfill their local databases.
@stephencdaly
stephencdaly force-pushed the change-unique-indexes-for-form-documents branch from b4ada4b to b43a8a7 Compare August 13, 2026 15:03
@github-actions

Copy link
Copy Markdown

🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-3021.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 marked this pull request as ready for review August 13, 2026 15:07
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.

1 participant