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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-11-14 11:41:52 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-11-14 11:41:52 +0300
commit585826cb22ecea5998a2c2a4675735c94bdeedac (patch)
tree5b05f0b30d33cef48963609e8a18a4dff260eab3 /db/post_migrate/20231024080150_cleanup_ci_sources_pipelines_pipeline_id_bigint.rb
parentdf221d036e5d0c6c0ee4d55b9c97f481ee05dee8 (diff)
Add latest changes from gitlab-org/gitlab@16-6-stable-eev16.6.0-rc42
Diffstat (limited to 'db/post_migrate/20231024080150_cleanup_ci_sources_pipelines_pipeline_id_bigint.rb')
-rw-r--r--db/post_migrate/20231024080150_cleanup_ci_sources_pipelines_pipeline_id_bigint.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/db/post_migrate/20231024080150_cleanup_ci_sources_pipelines_pipeline_id_bigint.rb b/db/post_migrate/20231024080150_cleanup_ci_sources_pipelines_pipeline_id_bigint.rb
new file mode 100644
index 00000000000..6aa8019a182
--- /dev/null
+++ b/db/post_migrate/20231024080150_cleanup_ci_sources_pipelines_pipeline_id_bigint.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+class CleanupCiSourcesPipelinesPipelineIdBigint < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ TABLE = :ci_sources_pipelines
+ REFERENCING_TABLE = :ci_pipelines
+ COLUMNS = [:pipeline_id, :source_pipeline_id]
+
+ def up
+ with_lock_retries(raise_on_exhaustion: true) do
+ lock_tables(:ci_pipelines, TABLE)
+ cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS) # rubocop:disable Migration/WithLockRetriesDisallowedMethod
+ end
+ end
+
+ def down
+ restore_conversion_of_integer_to_bigint(TABLE, COLUMNS)
+
+ add_concurrent_index(TABLE, :pipeline_id_convert_to_bigint,
+ name: :index_ci_sources_pipelines_on_pipeline_id_bigint)
+ add_concurrent_index(TABLE, :source_pipeline_id_convert_to_bigint,
+ name: :index_ci_sources_pipelines_on_source_pipeline_id_bigint)
+ add_concurrent_foreign_key(
+ TABLE, REFERENCING_TABLE,
+ column: :pipeline_id_convert_to_bigint,
+ on_delete: :cascade, validate: true, reverse_lock_order: true
+ )
+ add_concurrent_foreign_key(
+ TABLE, REFERENCING_TABLE,
+ column: :source_pipeline_id_convert_to_bigint,
+ on_delete: :cascade, validate: true, reverse_lock_order: true
+ )
+ end
+end