Skip to content

Fix rename table migration procedure

Adam Hegyi requested to merge fix-rename-table-in-pg-adapter into master

What does this MR do?

This change fixes a few issues with the rename table migration procedure. During #201856 (closed) we've identified that in some cases ActiveRecord does not use the schema cache and it queries the schema directly.

This is a problem in a zero-downtime migration environment.

  1. Migrations are executed (not post migrations), the table is renamed, the view is in place.
  2. A node, using the old version of the application is restarted.
  3. The restarted node queries the schema directly and determines that there is no FK (on the view).
  4. Application errors can happen due to the missing primary key.
  5. Issue is fixed once the deployment finishes.

This MR ensures that all schema lookup related methods proxy the query to the correct database table.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • 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 Adam Hegyi

Merge request reports