Skip to content

Conflict-free schema version handling

What does this MR do?

Remove conflicts from structure.sql that are caused by tracking the schema_migrations.versions information. To do this, store an empty file named after each version under the db/schema_migrations directory. That way when we versions are added or removed, we add or delete files from the directory, which should not conflict with other changes.

The original idea was proposed in #212425 (closed). The proposed solution was to use pg_ls_dir, but as of PG9.6 that is not an option as it can only read from files within the db cluster directory or log directory. This could be revisited with the pending PG11 upgrade, but even on that version reading files outside those directories requires elevated privileges that may complicate management of database users.

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Patrick Bair

Merge request reports