Skip to content

Remove declaration_text from forms (part 2/2) - #3108

Draft
lfdebrux wants to merge 3 commits into
mainfrom
ldeb-remove-declaration-text--part-2
Draft

lfdebrux wants to merge 3 commits into
mainfrom
ldeb-remove-declaration-text--part-2

Conversation

@lfdebrux

@lfdebrux lfdebrux commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

What problem does this pull request solve?

The declaration_text attribute on the forms model has been replaced with the declaration_markdown attribute and deprecated. It is no longer read in forms-runner or read or updated in forms-admin.

Removing the deprecated attribute completely will simplify the form model and reduce the possibility of confusion.

Removing the attribute from the forms model will not remove it from the form document model or change existing form document contents, but will stop if from being present in new form documents.

This change will prevent declaration_text being copied from a form document to a form model when copying a form form or reverting a draft form, but there are no form documents in the production database which have declaration_text but not declaration_markdown that could cause issues 1.

This PR tells adds migrations and updates the schema to delete the declaration_text column(s).

This PR should not be merged until #3107 has been merged and deployed to production.

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?

Footnotes

  1. This was verified with the following SQL query:

     gds aws forms-prod-support -- forms data_api -d forms-admin -s $'SELECT form_id, tag, version, language, content->\'declaration_text\' AS declaration_text, content->\'declaration_markdown\' AS declaration_markdown FROM form_documents WHERE content @@ \'($.declaration_text != null && $.declaration_text != "") && ($.declaration_markdown == null || $.declaration_markdown == "")\';'
    

    Prior to https://github.com/govuk-forms/forms-runner/pull/2334, the only situation when the declaration_text attribute was read was when declaration_markdown was blank.

    There are two forms in the production database where declaration_markdown is blank and declaration_text is present, however, these were reported as bugs by a form creator, as they had wanted to remove the form declaration.

`declaration_text` is deprecated and not set by any of the pages
in forms-admin. It would be good to remove it altogether. Update specs
that use `declaration_text` to use the replacement,
`declaration_markdown`, instead.
The `declaration_text` attribute on the forms model has been replaced
with the `declaration_markdown` attribute and deprecated. It is no
longer read in forms-runner or read or updated in forms-admin.

Removing the attribute completely will simplify the form model and
reduce the possibility of confusion.

Removing the attribute from the forms model will not change existing
form documents, but will stop if from being present in new form
documents.

This change will prevent `declaration_text` being copied from a form
document to a form model when copying a form form or reverting a draft
form, but there are no form documents in the production database which
have declaration_text but not declaration_markdown that could cause
issues [^1].

This commit tells the form model to ignore the `declaration_text`
column, so that it can be safely removed in a future migration.

---

[^1]: This was verified with the following SQL query:

```
gds aws forms-prod-support -- forms data_api -d forms-admin -s $'SELECT form_id, tag, version, language, content->\'declaration_text\' AS declaration_text, content->\'declaration_markdown\' AS declaration_markdown FROM form_documents WHERE content @@ \'($.declaration_text != null && $.declaration_text != "") && ($.declaration_markdown == null || $.declaration_markdown == "")\';'
```

Prior to govuk-forms/forms-runner#2334, the only
situation when the `declaration_text` attribute was read was when
`declaration_markdown` was blank.

There are two forms in the production database where
`declaration_markdown` is blank and `declaration_text` is present,
however, these were reported as bugs by a form creator, as they had
wanted to remove the form declaration.
Remove the `declaration_text` column from the `forms` and
`form_translations` tables.
@github-actions

Copy link
Copy Markdown

🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-3108.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.

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