Commit bcf63697 authored by Etienne Baqué's avatar Etienne Baqué

Added deploy_key_id fk to push access levels

parent 12914d79
# frozen_string_literal: true
class AddDeployKeyIdToPushAccessLevels < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_column :protected_branch_push_access_levels, :deploy_key_id, :integer
add_concurrent_foreign_key :protected_branch_push_access_levels, :keys, column: :deploy_key_id, on_delete: :cascade
add_concurrent_index :protected_branch_push_access_levels, :deploy_key_id, name: 'index_deploy_key_id_on_protected_branch_push_access_levels'
end
def down
remove_column :protected_branch_push_access_levels, :deploy_key_id
end
end
......@@ -14501,7 +14501,8 @@ CREATE TABLE public.protected_branch_push_access_levels (
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
user_id integer,
group_id integer
group_id integer,
deploy_key_id integer
);
CREATE SEQUENCE public.protected_branch_push_access_levels_id_seq
......@@ -19025,6 +19026,8 @@ CREATE INDEX index_dependency_proxy_blobs_on_group_id_and_file_name ON public.de
CREATE INDEX index_dependency_proxy_group_settings_on_group_id ON public.dependency_proxy_group_settings USING btree (group_id);
CREATE INDEX index_deploy_key_id_on_protected_branch_push_access_levels ON public.protected_branch_push_access_levels USING btree (deploy_key_id);
CREATE INDEX index_deploy_keys_projects_on_deploy_key_id ON public.deploy_keys_projects USING btree (deploy_key_id);
CREATE INDEX index_deploy_keys_projects_on_project_id ON public.deploy_keys_projects USING btree (project_id);
......@@ -20908,6 +20911,9 @@ ALTER TABLE ONLY public.vulnerabilities
ALTER TABLE ONLY public.vulnerabilities
ADD CONSTRAINT fk_131d289c65 FOREIGN KEY (milestone_id) REFERENCES public.milestones(id) ON DELETE SET NULL;
ALTER TABLE ONLY public.protected_branch_push_access_levels
ADD CONSTRAINT fk_15d2a7a4ae FOREIGN KEY (deploy_key_id) REFERENCES public.keys(id) ON DELETE CASCADE;
ALTER TABLE ONLY public.internal_ids
ADD CONSTRAINT fk_162941d509 FOREIGN KEY (namespace_id) REFERENCES public.namespaces(id) ON DELETE CASCADE;
......@@ -23686,6 +23692,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200617001848
20200617002030
20200617150041
20200617205000
20200618105638
20200618134223
20200618134723
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment