Skip to content

Replace runner token indices with unique indices

The indices in the following tables are not unique. We should create new unique indices and drop the old ones, taking care of rotating any existing duplicate tokens:

gitlabhq_dblab> \d index_ci_runners_on_token
+--------+------------------------+------------+
| Column | Type                   | Definition |
|--------+------------------------+------------|
| token  | character varying(255) | token      |
+--------+------------------------+------------+
btree, for table "public.ci_runners"

gitlabhq_dblab> \d index_ci_runners_on_token_encrypted
+-----------------+-------------------+-----------------+
| Column          | Type              | Definition      |
|-----------------+-------------------+-----------------|
| token_encrypted | character varying | token_encrypted |
+-----------------+-------------------+-----------------+
btree, for table "public.ci_runners"

gitlabhq_dblab> \d index_projects_on_runners_token
+---------------+-------------------+---------------+
| Column        | Type              | Definition    |
|---------------+-------------------+---------------|
| runners_token | character varying | runners_token |
+---------------+-------------------+---------------+
btree, for table "public.projects"

gitlabhq_dblab> \d index_projects_on_runners_token_encrypted
+-------------------------+-------------------+-------------------------+
| Column                  | Type              | Definition              |
|-------------------------+-------------------+-------------------------|
| runners_token_encrypted | character varying | runners_token_encrypted |
+-------------------------+-------------------+-------------------------+
btree, for table "public.projects"

Proposal

  1. %14.10 - !81991 (merged) - Create migration that nullifies duplicate values;
  2. %15.0 - #355977 (closed) - Create migration that replaces indices with unique indices and removes temporary indices.

Related

Edited by Pedro Pombeiro