From 0e7b810de07d1e42360a0021e5f8d2e088fac68f Mon Sep 17 00:00:00 2001 From: ghinfey Date: Thu, 17 Jul 2025 10:07:02 +0100 Subject: [PATCH] Rename author_email column to committer_email on gpg_signatures table Changelog: changed MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/198068 --- app/models/commit_signatures/gpg_signature.rb | 2 ++ ..._committer_email_on_gpg_signature_table.rb | 20 +++++++++++++++++++ ...hor_email_on_gpg_signature_table_rename.rb | 14 +++++++++++++ db/schema_migrations/20250717090253 | 1 + db/schema_migrations/20250717150035 | 1 + db/structure.sql | 4 ++-- 6 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20250717090253_rename_author_email_to_committer_email_on_gpg_signature_table.rb create mode 100644 db/post_migrate/20250717150035_cleanup_author_email_on_gpg_signature_table_rename.rb create mode 100644 db/schema_migrations/20250717090253 create mode 100644 db/schema_migrations/20250717150035 diff --git a/app/models/commit_signatures/gpg_signature.rb b/app/models/commit_signatures/gpg_signature.rb index 7422ccd380531e..8876a38039ed32 100644 --- a/app/models/commit_signatures/gpg_signature.rb +++ b/app/models/commit_signatures/gpg_signature.rb @@ -12,6 +12,8 @@ class GpgSignature < ApplicationRecord validates :gpg_key_primary_keyid, presence: true + ignore_column :author_email, remove_with: '18.4', remove_after: '2025-08-16' + def signed_by_user return gpg_key.user if gpg_key diff --git a/db/migrate/20250717090253_rename_author_email_to_committer_email_on_gpg_signature_table.rb b/db/migrate/20250717090253_rename_author_email_to_committer_email_on_gpg_signature_table.rb new file mode 100644 index 00000000000000..d82980a4a5997e --- /dev/null +++ b/db/migrate/20250717090253_rename_author_email_to_committer_email_on_gpg_signature_table.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class RenameAuthorEmailToCommitterEmailOnGpgSignatureTable < Gitlab::Database::Migration[2.3] + milestone '18.3' + disable_ddl_transaction! + + CONSTRAINT_NAME = 'check_d113461ed1' + + def up + remove_check_constraint :gpg_signatures, CONSTRAINT_NAME + rename_column_concurrently :gpg_signatures, :author_email, :committer_email + add_text_limit :gpg_signatures, :committer_email, 255, constraint_name: CONSTRAINT_NAME + end + + def down + remove_check_constraint :gpg_signatures, CONSTRAINT_NAME + undo_rename_column_concurrently :gpg_signatures, :author_email, :committer_email + add_text_limit :gpg_signatures, :author_email, 255, constraint_name: CONSTRAINT_NAME + end +end diff --git a/db/post_migrate/20250717150035_cleanup_author_email_on_gpg_signature_table_rename.rb b/db/post_migrate/20250717150035_cleanup_author_email_on_gpg_signature_table_rename.rb new file mode 100644 index 00000000000000..67c3db758c3237 --- /dev/null +++ b/db/post_migrate/20250717150035_cleanup_author_email_on_gpg_signature_table_rename.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class CleanupAuthorEmailOnGpgSignatureTableRename < Gitlab::Database::Migration[2.3] + milestone '18.3' + disable_ddl_transaction! + + def up + cleanup_concurrent_column_rename :gpg_signatures, :author_email, :committer_email + end + + def down + undo_cleanup_concurrent_column_rename :gpg_signatures, :author_email, :committer_email + end +end diff --git a/db/schema_migrations/20250717090253 b/db/schema_migrations/20250717090253 new file mode 100644 index 00000000000000..19885dec642d4c --- /dev/null +++ b/db/schema_migrations/20250717090253 @@ -0,0 +1 @@ +d57bd60cc230826fbeafaa3568d46b783f461964f9bd97209c6b0548103cc2ce \ No newline at end of file diff --git a/db/schema_migrations/20250717150035 b/db/schema_migrations/20250717150035 new file mode 100644 index 00000000000000..c7b02859f886b2 --- /dev/null +++ b/db/schema_migrations/20250717150035 @@ -0,0 +1 @@ +09ad321f159e0352380d97a150e414ef7da05d39f2d640dd6a95eeff693408ff \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index a4d96545803bda..ddf3e9e4fa12ad 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -15347,8 +15347,8 @@ CREATE TABLE gpg_signatures ( gpg_key_user_email text, verification_status smallint DEFAULT 0 NOT NULL, gpg_key_subkey_id bigint, - author_email text, - CONSTRAINT check_d113461ed1 CHECK ((char_length(author_email) <= 255)) + committer_email text, + CONSTRAINT check_d113461ed1 CHECK ((char_length(committer_email) <= 255)) ); CREATE SEQUENCE gpg_signatures_id_seq -- GitLab