gitlab-org--gitlab-foss/db
Stan Hu 3126e89eb8
Add a unique and not null constraint on the project_features.project_id column
This commit has two migrations:

1. The first prunes duplicate rows in the project_features table and leaves
   the row with the highest ID.  Since the behavior was indeterministic before
   and depended on which row the database decided to use, this change at least
   makes the permissions consistent. For example, in some cases, the Wiki may
   have been disabled but enabled in another entry.

2. The second adds a non-null constraint on the project_features.project_id
   column.

Closes #37882

Fixes a significant part of gitlab-com/migration#408.

We found that we were overcounting Wikis because of these duplicates.
On GitLab.com, there are 56 rows with duplicate entries by project_id, and 16,661 rows with NULL project_id values.
2018-05-15 14:20:14 +02:00
..
fixtures Move spec helpers/matchers/shared examples/contexts to their relevant folder 2018-04-23 12:20:30 +02:00
migrate Add index on runner_type for ci_runners 2018-05-15 12:01:00 +02:00
post_migrate Add a unique and not null constraint on the project_features.project_id column 2018-05-15 14:20:14 +02:00
schema.rb Add a unique and not null constraint on the project_features.project_id column 2018-05-15 14:20:14 +02:00
seeds.rb