Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-11-16 15:10:23 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-16 15:10:23 +0300
commitdc9ff5fda1337883acd09fd4b98be2f6a41ad037 (patch)
tree0c720bccd583ddfb7ae355b81459d8e2ecde8ae8 /db
parent2c90b9b579fbfe3db191a032d2cb176761605a02 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20211112113300_remove_ci_pipeline_chat_data_fk_on_chat_names.rb22
-rw-r--r--db/schema_migrations/202111121133001
-rw-r--r--db/structure.sql3
3 files changed, 23 insertions, 3 deletions
diff --git a/db/post_migrate/20211112113300_remove_ci_pipeline_chat_data_fk_on_chat_names.rb b/db/post_migrate/20211112113300_remove_ci_pipeline_chat_data_fk_on_chat_names.rb
new file mode 100644
index 00000000000..19adc6c7084
--- /dev/null
+++ b/db/post_migrate/20211112113300_remove_ci_pipeline_chat_data_fk_on_chat_names.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class RemoveCiPipelineChatDataFkOnChatNames < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists(:ci_pipeline_chat_data, :chat_names, name: "fk_rails_f300456b63")
+ end
+ end
+
+ def down
+ # Remove orphaned rows
+ execute <<~SQL
+ DELETE FROM ci_pipeline_chat_data
+ WHERE
+ NOT EXISTS (SELECT 1 FROM chat_names WHERE chat_names.id=ci_pipeline_chat_data.chat_name_id)
+ SQL
+
+ add_concurrent_foreign_key(:ci_pipeline_chat_data, :chat_names, name: "fk_rails_f300456b63", column: :chat_name_id, target_column: :id, on_delete: "cascade")
+ end
+end
diff --git a/db/schema_migrations/20211112113300 b/db/schema_migrations/20211112113300
new file mode 100644
index 00000000000..8074c437751
--- /dev/null
+++ b/db/schema_migrations/20211112113300
@@ -0,0 +1 @@
+be11c0b1c7b9c99c28d44c164742815da57bfc4a32afd54df9135e3ce6edeff9 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 7e366cd67d3..5b6614be454 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -31078,9 +31078,6 @@ ALTER TABLE ONLY snippet_repositories
ALTER TABLE ONLY elastic_reindexing_subtasks
ADD CONSTRAINT fk_rails_f2cc190164 FOREIGN KEY (elastic_reindexing_task_id) REFERENCES elastic_reindexing_tasks(id) ON DELETE CASCADE;
-ALTER TABLE ONLY ci_pipeline_chat_data
- ADD CONSTRAINT fk_rails_f300456b63 FOREIGN KEY (chat_name_id) REFERENCES chat_names(id) ON DELETE CASCADE;
-
ALTER TABLE ONLY approval_project_rules_users
ADD CONSTRAINT fk_rails_f365da8250 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;