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:
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20231222071942_add_description_to_ci_instance_variables.rb12
-rw-r--r--db/migrate/20240104150106_add_partition_id_to_pipeline_metadata.rb10
-rw-r--r--db/migrate/20240104191736_migrate_zoekt_indexed_namespaces_to_zoekt_enabled_namespaces.rb30
-rw-r--r--db/migrate/20240104191802_migrate_zoekt_indexed_namespaces_to_zoekt_indices.rb46
-rw-r--r--db/migrate/20240109082354_add_partition_id_to_pipeline_artifact.rb10
5 files changed, 108 insertions, 0 deletions
diff --git a/db/migrate/20231222071942_add_description_to_ci_instance_variables.rb b/db/migrate/20231222071942_add_description_to_ci_instance_variables.rb
new file mode 100644
index 00000000000..e71f27411eb
--- /dev/null
+++ b/db/migrate/20231222071942_add_description_to_ci_instance_variables.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+class AddDescriptionToCiInstanceVariables < Gitlab::Database::Migration[2.2]
+ milestone '16.8'
+ enable_lock_retries!
+
+ # rubocop:disable Migration/AddLimitToTextColumns -- text limit is added in 20231222072237_add_text_limit_to_ci_instance_variables_description.rb migration
+ def change
+ add_column(:ci_instance_variables, :description, :text)
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+end
diff --git a/db/migrate/20240104150106_add_partition_id_to_pipeline_metadata.rb b/db/migrate/20240104150106_add_partition_id_to_pipeline_metadata.rb
new file mode 100644
index 00000000000..cdada059306
--- /dev/null
+++ b/db/migrate/20240104150106_add_partition_id_to_pipeline_metadata.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class AddPartitionIdToPipelineMetadata < Gitlab::Database::Migration[2.2]
+ milestone '16.8'
+ enable_lock_retries!
+
+ def change
+ add_column(:ci_pipeline_metadata, :partition_id, :bigint, default: 100, null: false)
+ end
+end
diff --git a/db/migrate/20240104191736_migrate_zoekt_indexed_namespaces_to_zoekt_enabled_namespaces.rb b/db/migrate/20240104191736_migrate_zoekt_indexed_namespaces_to_zoekt_enabled_namespaces.rb
new file mode 100644
index 00000000000..3c3ef67e322
--- /dev/null
+++ b/db/migrate/20240104191736_migrate_zoekt_indexed_namespaces_to_zoekt_enabled_namespaces.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class MigrateZoektIndexedNamespacesToZoektEnabledNamespaces < Gitlab::Database::Migration[2.2]
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ milestone '16.8'
+
+ INSERTED_COLUMNS = %w[
+ root_namespace_id
+ search
+ created_at
+ updated_at
+ ].join(',')
+
+ def up
+ connection.execute(<<~SQL)
+ INSERT INTO zoekt_enabled_namespaces (#{INSERTED_COLUMNS})
+ (SELECT DISTINCT ON (namespace_id) namespace_id, search, created_at, updated_at
+ FROM zoekt_indexed_namespaces ORDER BY namespace_id, search)
+ SQL
+ end
+
+ def down
+ connection.execute(<<~SQL)
+ DELETE FROM zoekt_enabled_namespaces
+ SQL
+ end
+end
diff --git a/db/migrate/20240104191802_migrate_zoekt_indexed_namespaces_to_zoekt_indices.rb b/db/migrate/20240104191802_migrate_zoekt_indexed_namespaces_to_zoekt_indices.rb
new file mode 100644
index 00000000000..5461ad5094b
--- /dev/null
+++ b/db/migrate/20240104191802_migrate_zoekt_indexed_namespaces_to_zoekt_indices.rb
@@ -0,0 +1,46 @@
+# frozen_string_literal: true
+
+class MigrateZoektIndexedNamespacesToZoektIndices < Gitlab::Database::Migration[2.2]
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ milestone '16.8'
+
+ INSERTED_COLUMNS = %w[
+ zoekt_enabled_namespace_id
+ namespace_id
+ zoekt_node_id
+ state
+ created_at
+ updated_at
+ ].join(',')
+
+ STATE_READY = 10
+
+ def up
+ connection.execute(<<~SQL)
+ WITH indexed_namespaces AS (
+ (SELECT DISTINCT ON (namespace_id) namespace_id, search, zoekt_node_id
+ FROM zoekt_indexed_namespaces ORDER BY namespace_id, search)
+ )
+
+ INSERT INTO zoekt_indices (#{INSERTED_COLUMNS})
+ SELECT
+ zoekt_enabled_namespaces.id,
+ indexed_namespaces.namespace_id,
+ indexed_namespaces.zoekt_node_id,
+ #{STATE_READY},
+ NOW(),
+ NOW()
+ FROM zoekt_enabled_namespaces
+ JOIN indexed_namespaces ON indexed_namespaces.namespace_id = zoekt_enabled_namespaces.root_namespace_id
+ SQL
+ end
+
+ def down
+ connection.execute(<<~SQL)
+ DELETE FROM zoekt_indices
+ SQL
+ end
+end
diff --git a/db/migrate/20240109082354_add_partition_id_to_pipeline_artifact.rb b/db/migrate/20240109082354_add_partition_id_to_pipeline_artifact.rb
new file mode 100644
index 00000000000..8a922aed648
--- /dev/null
+++ b/db/migrate/20240109082354_add_partition_id_to_pipeline_artifact.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class AddPartitionIdToPipelineArtifact < Gitlab::Database::Migration[2.2]
+ milestone '16.8'
+ enable_lock_retries!
+
+ def change
+ add_column(:ci_pipeline_artifacts, :partition_id, :bigint, default: 100, null: false)
+ end
+end