Skip to content
Snippets Groups Projects

Model changes for code owner approval rules

Merged Bob Van Landuyt requested to merge reprazent/gitlab-ee:bvl-codeowner-rules-model into master

What does this MR do?

This is a first step in https://gitlab.com/gitlab-org/gitlab-ee/issues/4418 not all code is used in this MR, but it will be in https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9293.

This adds a partial unique index for approval_merge_request_rules, the name must be unique scoped to a merge request when code_owners = 't'. This is also enforced by validations. A helper method for creating/finding code owner rules avoiding race conditions.

This index is safe to add, as we already only create one code_owner row in that table. Now the database will enforce this.

Does this MR meet the acceptance criteria?

Edited by Alexandru Croitor

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Author Maintainer

    @oswaldo Would you mind taking a first look at the code here?

  • assigned to @oswaldo

  • Alexandru Croitor marked the checklist item Conforms to the code review guidelines as completed

    marked the checklist item Conforms to the code review guidelines as completed

  • Alexandru Croitor marked the checklist item Conforms to the code review guidelines as incomplete

    marked the checklist item Conforms to the code review guidelines as incomplete

  • Bob Van Landuyt added 19 commits

    added 19 commits

    • b4cddd3c...1c123259 - 17 commits from branch gitlab-org:master
    • 9fa9a7dc - Add unique index merge_request_approval_rules.name
    • 2a1cd671 - Model changes for code owner approval rules

    Compare with previous version

  • @reprazent Nice work :) Code looks mostly good to me, just a few minor comments.

    Sounds like we got a few conflicts though.

  • Bob Van Landuyt added 3 commits

    added 3 commits

    • 68996679 - Don't create partial unique indexes on MySQL
    • 093178b0 - Adds helper for `find_or_create_by` in transaction
    • 63c5279a - Model changes for code owner approval rules

    Compare with previous version

  • Bob Van Landuyt added 138 commits

    added 138 commits

    • 63c5279a...6706a00c - 134 commits from branch gitlab-org:master
    • 66fdedef - Add unique index merge_request_approval_rules.name
    • 23524ea9 - Don't create partial unique indexes on MySQL
    • 44c5a0fa - Adds helper for `find_or_create_by` in transaction
    • b853a47a - Model changes for code owner approval rules

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading