Commit 230c1015 authored by Andreas Brandl's avatar Andreas Brandl

Merge branch 'issue_299084-database_work' into 'master'

Database work to support inherited templates on service desk

See merge request gitlab-org/gitlab!67546
parents 7492453a 200fe009
# frozen_string_literal: true
class AddFileTemplateProjectToServiceDeskSettings < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
def change
add_column :service_desk_settings, :file_template_project_id, :bigint, null: true
end
end
# frozen_string_literal: true
class AddFileTemplateProjectForeignKeyToServiceDeskSettings < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
INDEX_NAME = 'index_service_desk_settings_on_file_template_project_id'
def up
add_concurrent_index :service_desk_settings, :file_template_project_id, name: INDEX_NAME
add_concurrent_foreign_key :service_desk_settings, :projects, column: :file_template_project_id, on_delete: :nullify
end
def down
with_lock_retries do
remove_foreign_key_if_exists :service_desk_settings, column: :file_template_project_id
end
remove_concurrent_index_by_name :service_desk_settings, name: INDEX_NAME
end
end
d24d10134d661728dbe688da2b90da55c584627ca764a6cc4604631f8a5fa334
\ No newline at end of file
25eb43de74e7eb158718b19d8cea5da2540507e96fcbe47d4829fa806e773308
\ No newline at end of file
......@@ -18336,7 +18336,8 @@ CREATE TABLE service_desk_settings (
project_id bigint NOT NULL,
issue_template_key character varying(255),
outgoing_name character varying(255),
project_key character varying(255)
project_key character varying(255),
file_template_project_id bigint
);
CREATE TABLE shards (
......@@ -25404,6 +25405,8 @@ CREATE INDEX index_serverless_domain_cluster_on_pages_domain_id ON serverless_do
CREATE INDEX index_service_desk_enabled_projects_on_id_creator_id_created_at ON projects USING btree (id, creator_id, created_at) WHERE (service_desk_enabled = true);
CREATE INDEX index_service_desk_settings_on_file_template_project_id ON service_desk_settings USING btree (file_template_project_id);
CREATE UNIQUE INDEX index_shards_on_name ON shards USING btree (name);
CREATE UNIQUE INDEX index_site_profile_secret_variables_on_site_profile_id_and_key ON dast_site_profile_secret_variables USING btree (dast_site_profile_id, key);
......@@ -26265,6 +26268,9 @@ ALTER TABLE ONLY clusters_applications_runners
ALTER TABLE ONLY incident_management_escalation_rules
ADD CONSTRAINT fk_0314ee86eb FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
ALTER TABLE ONLY service_desk_settings
ADD CONSTRAINT fk_03afb71f06 FOREIGN KEY (file_template_project_id) REFERENCES projects(id) ON DELETE SET NULL;
ALTER TABLE ONLY design_management_designs_versions
ADD CONSTRAINT fk_03c671965c FOREIGN KEY (design_id) REFERENCES design_management_designs(id) ON DELETE CASCADE;
......@@ -297,6 +297,7 @@ excluded_attributes:
- :integrated
service_desk_setting:
- :outgoing_name
- :file_template_project_id
priorities:
- :label_id
events:
......
......@@ -149,6 +149,7 @@ build_service_desk_setting: # service_desk_setting
unexposed_attributes:
- project_id
- issue_template_key
- file_template_project_id
- outgoing_name
remapped_attributes:
project_key: service_desk_address
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