Add a description text field to environment details [BE & DB]

What does this MR do and why?

This MR adds a new field description and it's markdown variant description_html to the environment. The field is exposed to GraphQl and will be used within the next MR on the environment details, new and edit pages.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Migration output:

main: == [advisory_lock_connection] object_id: 203380, pg_backend_pid: 62632
ci: == [advisory_lock_connection] object_id: 209340, pg_backend_pid: 62793
ci: == 20240920175849 AddDescriptionToEnvironments: migrating =====================
ci: -- transaction_open?(nil)
ci:    -> 0.0000s
ci: -- column_exists?(:environments, :description)
ci:    -> 0.0030s
ci: -- add_column(:environments, :description, :text)
ci:    -> 0.0009s
ci: -- column_exists?(:environments, :description_html)
ci:    -> 0.0024s
ci: -- add_column(:environments, :description_html, :text)
ci:    -> 0.0007s
ci: -- column_exists?(:environments, :cached_markdown_version)
ci:    -> 0.0023s
ci: -- add_column(:environments, :cached_markdown_version, :integer)
ci:    -> 0.0007s
ci: -- transaction_open?(nil)
ci:    -> 0.0000s
ci: -- transaction_open?(nil)
ci:    -> 0.0000s
ci: -- execute("ALTER TABLE environments\nADD CONSTRAINT check_ad5e1ed5e1\nCHECK ( char_length(description) <= 10000 )\nNOT VALID;\n")
ci:    -> 0.0008s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0004s
ci: -- execute("ALTER TABLE environments VALIDATE CONSTRAINT check_ad5e1ed5e1;")
ci:    -> 0.0007s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0004s
ci: -- transaction_open?(nil)
ci:    -> 0.0000s
ci: -- transaction_open?(nil)
ci:    -> 0.0000s
ci: -- execute("ALTER TABLE environments\nADD CONSTRAINT check_d26221226f\nCHECK ( char_length(description_html) <= 50000 )\nNOT VALID;\n")
ci:    -> 0.0011s
ci: -- execute("ALTER TABLE environments VALIDATE CONSTRAINT check_d26221226f;")
ci:    -> 0.0041s
ci: == 20240920175849 AddDescriptionToEnvironments: migrated (0.0527s) ============

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Related to #450944 (closed)

Edited by Anna Vovchenko

Merge request reports

Loading