Skip to content

Enforce presence of UUID and version in VsCodeSetting model

Problem

In Settings sync API adjustments (!133668 - merged), we added two new fields to the VsCodeSetting model: UUID and version. These fields don't have a presence validation which is desirable.

Solution

This issue follows-up on #432992 (closed) which implements a backfill migration to set values for the uuid and version fields in the vscode_settings table. After that background migration runs, we will enable the not null validation in these fields.

The following discussion from !133668 (merged) should be addressed:

  • @cwoolley-gitlab started a discussion: (+1 comment)

    suggestion (non-blocking) Even if we don't need to enforce uniqueness, is there a reason we don't want to go ahead and make the uuid and version fields required (null: false) and validate presence on the model?

    I realize this introduces more complexity in terms of having to backfill existing records with a non-null default value, but it will help ensure data integrity if the field will actually always be required.

    This can be done in follow-up MRs.

Availability and Testing

Ensure updated test coverage in unit/integration/feature tests.

Edited by Enrique Alcántara