Add NOT NULL constraint to "path_locks.project_id"
What does this MR do and why?
Contributes to #444643 (closed)
Problem
project_id
field in path_locks
table misses a NOT NULL check.
Solution
The Rails validation to prevent empty project_id
values exists for 7
years
GitLab database doesn't include any NULL records as well.
select * from path_locks where project_id is NULL;
Index Scan using index_path_locks_on_project_id on public.path_locks (cost=0.29..2.16 rows=1 width=54) (actual time=2.452..2.453 rows=0 loops=1)
Index Cond: (path_locks.project_id IS NULL)
Buffers: shared read=2
I/O Timings: read=2.414 write=0.000
https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/26845/commands/83644
We can proceed and add a missing contstraint for this field.