Skip to content

Missing 'instance' column on services table after successful migration

Description

!25714 (merged) introduced a new column instance on the services table.

Some users on self-hosted instances are reporting that the migration script appears as successfully applied (up), but has not created the column in the database:

The current workaround that we are offering is to remove the migrations from schema_migrations table and run the migrations again:

  1. Enter the PostgreSQL console:
sudo gitlab-rails dbconsole
  1. Delete non applied migrations:
    • 20200310132654 Add instance to services
    • 20200310135823 Add index to service unique instance per type
DELETE FROM schema_migrations WHERE schema_migrations.version = '20200310132654';
DELETE FROM schema_migrations WHERE schema_migrations.version = '20200310135823';
  1. Exit the console and then run the migrations:
sudo gitlab-rake db:migrate:up VERSION=20200310132654
sudo gitlab-rake db:migrate:up VERSION=20200310135823

We need to investigate why migration appears to be applied but has not created the column.

Edited by Arturo Herrero