Add `deploy_key_id` field to `protected_tag_create_access_levels`
What does this MR do and why?
Contributes to #325415 (closed)
Roadmap
Step | MR |
---|---|
Database migration to add deploy_key_id
|
|
Add associations and validations | !109911 (merged) |
Enable verification for protected tags creation | !110238 (merged) |
Allow users to choose Deploy keys for protected tags | !110047 (merged) |
Documentation | !110240 (merged) |
Problem
We support deploy keys only for protected branches, but this functionality is missing for protected tags.
Solution
This commit adds a new field deploy_key_id
to match the same field in
protected_branches_push_access_levels
table.
Database
Up
main: == 20230124122143 AddDeployKeyIdToCreateAccessLevels: migrating ===============
main: -- add_column(:protected_tag_create_access_levels, :deploy_key_id, :integer)
main: -> 0.0027s
main: == 20230124122143 AddDeployKeyIdToCreateAccessLevels: migrated (0.0039s) ======
main: == 20230124193917 AddIndexForProtectedTagCreateAccessLevels: migrating ========
main: -- transaction_open?()
main: -> 0.0000s
main: -- transaction_open?()
main: -> 0.0000s
main: -- execute("ALTER TABLE protected_tag_create_access_levels\nADD CONSTRAINT fk_386a642e13\nFOREIGN KEY (deploy_key_id)\nREFERENCES keys (id)\n\nON DELETE CASCADE\nNOT VALID;\n")
main: -> 0.0014s
main: -- execute("SET statement_timeout TO 0")
main: -> 0.0003s
main: -- execute("ALTER TABLE protected_tag_create_access_levels VALIDATE CONSTRAINT fk_386a642e13;")
main: -> 0.0012s
main: -- execute("RESET statement_timeout")
main: -> 0.0003s
main: -- transaction_open?()
main: -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main: -> 0.0006s
main: -- index_exists?(:protected_tag_create_access_levels, :deploy_key_id, {:name=>"index_protected_tag_create_access_levels_on_deploy_key_id", :algorithm=>:concurrently})
main: -> 0.0050s
main: -- add_index(:protected_tag_create_access_levels, :deploy_key_id, {:name=>"index_protected_tag_create_access_levels_on_deploy_key_id", :algorithm=>:concurrently})
main: -> 0.0042s
main: == 20230124193917 AddIndexForProtectedTagCreateAccessLevels: migrated (0.1591s)
Down
main: == 20230124193917 AddIndexForProtectedTagCreateAccessLevels: reverting ========
main: -- remove_foreign_key(:protected_tag_create_access_levels, {:column=>:deploy_key_id})
main: -> 0.0033s
main: -- transaction_open?()
main: -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main: -> 0.0009s
main: -- indexes(:protected_tag_create_access_levels)
main: -> 0.0032s
main: -- execute("SET statement_timeout TO 0")
main: -> 0.0004s
main: -- remove_index(:protected_tag_create_access_levels, {:algorithm=>:concurrently, :name=>"index_protected_tag_create_access_levels_on_deploy_key_id"})
main: -> 0.0019s
main: -- execute("RESET statement_timeout")
main: -> 0.0013s
main: == 20230124193917 AddIndexForProtectedTagCreateAccessLevels: reverted (0.1239s)
main: == 20230124122143 AddDeployKeyIdToCreateAccessLevels: reverting ===============
main: -- remove_column(:protected_tag_create_access_levels, :deploy_key_id)
main: -> 0.0032s
main: == 20230124122143 AddDeployKeyIdToCreateAccessLevels: reverted (0.0066s) ======
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Vasilii Iakliushin