Skip to content

Specify primary key for table `merge_request_context_commit_diff_files`

The table merge_request_context_commit_diff_files doesn't have a primary key defined. Also, it doesn't have a suitable unique key which may be promoted to a primary key.

The goal here is to define a primary key for this table. This is important e.g. for logical replication to succeed, but also a requirement for tables in general.

# \d merge_request_context_commit_diff_files
                  Table "public.merge_request_context_commit_diff_files"
             Column              |          Type          | Collation | Nullable | Default 
---------------------------------+------------------------+-----------+----------+---------
 merge_request_context_commit_id | bigint                 |           |          | 
 sha                             | bytea                  |           | not null | 
 relative_order                  | integer                |           | not null | 
 a_mode                          | character varying(255) |           | not null | 
 b_mode                          | character varying(255) |           | not null | 
 new_file                        | boolean                |           | not null | 
 renamed_file                    | boolean                |           | not null | 
 deleted_file                    | boolean                |           | not null | 
 too_large                       | boolean                |           | not null | 
 binary                          | boolean                |           |          | 
 new_path                        | text                   |           | not null | 
 old_path                        | text                   |           | not null | 
 diff                            | text                   |           |          | 
Indexes:
    "idx_mr_cc_diff_files_on_mr_cc_id" btree (merge_request_context_commit_id)
    "idx_mr_cc_diff_files_on_mr_cc_id_and_sha" btree (merge_request_context_commit_id, sha)
Foreign-key constraints:
    "fk_rails_74a00a1787" FOREIGN KEY (merge_request_context_commit_id) REFERENCES merge_request_context_commits(id) ON DELETE CASCADE

TODOs

  • Determine owner for this issue
  • Gather statistics on those tables