diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-27 06:09:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-27 06:09:34 +0300 |
commit | d99ae624301a81cf0d2efa73d91cac07313ae949 (patch) | |
tree | 9bdcaefdeeb3f66644d198281000d217924b3f83 /db | |
parent | ccdcf4e139790b97b55c364ccdbd42af58c2a07f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20201119162801_change_services_inherit_from_id_foreign_key.rb | 19 | ||||
-rw-r--r-- | db/schema_migrations/20201119162801 | 1 | ||||
-rw-r--r-- | db/structure.sql | 6 |
3 files changed, 23 insertions, 3 deletions
diff --git a/db/migrate/20201119162801_change_services_inherit_from_id_foreign_key.rb b/db/migrate/20201119162801_change_services_inherit_from_id_foreign_key.rb new file mode 100644 index 00000000000..a7f12fcf726 --- /dev/null +++ b/db/migrate/20201119162801_change_services_inherit_from_id_foreign_key.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class ChangeServicesInheritFromIdForeignKey < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :services, :services, column: :inherit_from_id, on_delete: :cascade, name: 'fk_services_inherit_from_id' + remove_foreign_key_if_exists :services, name: 'fk_868a8e7ad6' + end + + def down + remove_foreign_key_if_exists :services, name: 'fk_services_inherit_from_id' + add_concurrent_foreign_key :services, :services, column: :inherit_from_id, on_delete: :nullify, name: 'fk_868a8e7ad6' + end +end diff --git a/db/schema_migrations/20201119162801 b/db/schema_migrations/20201119162801 new file mode 100644 index 00000000000..b6aa67ad5f6 --- /dev/null +++ b/db/schema_migrations/20201119162801 @@ -0,0 +1 @@ +c41f4649540c23d25f0ae26c3754476409b5e77f53b96db65f2c1fd4a6caf087
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 3be04c5f68d..2559cecd6db 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -23112,9 +23112,6 @@ ALTER TABLE ONLY merge_request_diffs ALTER TABLE ONLY ci_pipelines ADD CONSTRAINT fk_86635dbd80 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; -ALTER TABLE ONLY services - ADD CONSTRAINT fk_868a8e7ad6 FOREIGN KEY (inherit_from_id) REFERENCES services(id) ON DELETE SET NULL; - ALTER TABLE ONLY geo_event_log ADD CONSTRAINT fk_86c84214ec FOREIGN KEY (repository_renamed_event_id) REFERENCES geo_repository_renamed_events(id) ON DELETE CASCADE; @@ -24780,6 +24777,9 @@ ALTER TABLE ONLY resource_label_events ALTER TABLE ONLY ci_builds_metadata ADD CONSTRAINT fk_rails_ffcf702a02 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY services + ADD CONSTRAINT fk_services_inherit_from_id FOREIGN KEY (inherit_from_id) REFERENCES services(id) ON DELETE CASCADE; + ALTER TABLE ONLY timelogs ADD CONSTRAINT fk_timelogs_issues_issue_id FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE; |