Skip to content

Resolve "Fix NOT NULL differences between production and structure.sql"

What does this MR do and why?

In #211781, a number of schema inconsistencies were identified between the GitLab.com production database and the structure.sql file.

One such problem is columns that are defined as NOT NULL in one environment but not in another.

A summary can be found in the following (internal only) spreadsheet

This is pretty easily addressable if we have to remove the NOT NULL, but way harder the other way around.

At the moment all columns we have identified are defined as NOT NULL in production, but not in structure.sql, which should be easy to fix.

We should make sure that the definitions in structure.sql are indeed the preferred ones and remove the NOT NULL constraints from the columns in production.

main: == 20230126133531 RemoveNotNullConstraintsForTablesWithSchemaDifferencesV3: migrating
main: -- change_column_null(:integrations, :updated_at, true)
main:    -> 0.0042s
main: -- change_column_null(:integrations, :created_at, true)
main:    -> 0.0003s
main: -- change_column_null(:project_settings, :show_default_award_emojis, true)
main:    -> 0.0005s
main: == 20230126133531 RemoveNotNullConstraintsForTablesWithSchemaDifferencesV3: migrated (0.0101s)

Screenshots or screen recordings

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

How to set up and validate locally

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

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #285559

Edited by Diogo Frazão

Merge request reports

Loading