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/20230503100753_add_version_format_and_data_type_to_checkpoints.rb')
-rw-r--r--db/migrate/20230503100753_add_version_format_and_data_type_to_checkpoints.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20230503100753_add_version_format_and_data_type_to_checkpoints.rb b/db/migrate/20230503100753_add_version_format_and_data_type_to_checkpoints.rb
new file mode 100644
index 00000000000..97a0541cdb5
--- /dev/null
+++ b/db/migrate/20230503100753_add_version_format_and_data_type_to_checkpoints.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddVersionFormatAndDataTypeToCheckpoints < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ def up
+ add_column(:pm_checkpoints, :data_type, :integer, limit: 2, default: 1, null: false)
+ add_column(:pm_checkpoints, :version_format, :integer, limit: 2, default: 1, null: false)
+ add_index(:pm_checkpoints, [:purl_type, :data_type, :version_format], unique: true, name: :pm_checkpoints_unique_index) # rubocop:disable Migration/AddIndex
+ swap_primary_key(:pm_checkpoints, :pm_checkpoints_pkey, :pm_checkpoints_unique_index)
+ end
+
+ def down
+ add_index(:pm_checkpoints, [:purl_type], unique: true, name: :pm_checkpoints_unique_index) # rubocop:disable Migration/AddIndex
+ unswap_primary_key(:pm_checkpoints, :pm_checkpoints_pkey, :pm_checkpoints_unique_index)
+ remove_column(:pm_checkpoints, :version_format)
+ remove_column(:pm_checkpoints, :data_type)
+ end
+end