From 294ddf1dc1c130a87e0debc8d4c1465aae97edd6 Mon Sep 17 00:00:00 2001 From: ghinfey Date: Thu, 17 Jul 2025 09:57:10 +0100 Subject: [PATCH] Rename author_email column to committer_email on ssh_signatures table Changelog: changed MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/198064 --- app/models/commit_signatures/ssh_signature.rb | 2 ++ ..._committer_email_on_ssh_signature_table.rb | 20 +++++++++++++++++++ ...hor_email_on_ssh_signature_table_rename.rb | 14 +++++++++++++ db/schema_migrations/20250717081744 | 1 + db/schema_migrations/20250717105014 | 1 + db/structure.sql | 4 ++-- 6 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20250717081744_rename_author_email_to_committer_email_on_ssh_signature_table.rb create mode 100644 db/post_migrate/20250717105014_cleanup_author_email_on_ssh_signature_table_rename.rb create mode 100644 db/schema_migrations/20250717081744 create mode 100644 db/schema_migrations/20250717105014 diff --git a/app/models/commit_signatures/ssh_signature.rb b/app/models/commit_signatures/ssh_signature.rb index e9e16651d1c954..cbfa8ebed37bd4 100644 --- a/app/models/commit_signatures/ssh_signature.rb +++ b/app/models/commit_signatures/ssh_signature.rb @@ -8,6 +8,8 @@ class SshSignature < ApplicationRecord belongs_to :key, optional: true belongs_to :user, optional: true + ignore_column :author_email, remove_with: '18.4', remove_after: '2025-08-16' + def type :ssh end diff --git a/db/migrate/20250717081744_rename_author_email_to_committer_email_on_ssh_signature_table.rb b/db/migrate/20250717081744_rename_author_email_to_committer_email_on_ssh_signature_table.rb new file mode 100644 index 00000000000000..7f72a9d2533cf1 --- /dev/null +++ b/db/migrate/20250717081744_rename_author_email_to_committer_email_on_ssh_signature_table.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class RenameAuthorEmailToCommitterEmailOnSshSignatureTable < Gitlab::Database::Migration[2.3] + milestone '18.3' + disable_ddl_transaction! + + CONSTRAINT_NAME = 'check_5ff707c7f9' + + def up + remove_check_constraint :ssh_signatures, CONSTRAINT_NAME + rename_column_concurrently :ssh_signatures, :author_email, :committer_email + add_text_limit :ssh_signatures, :committer_email, 255, constraint_name: CONSTRAINT_NAME + end + + def down + remove_check_constraint :ssh_signatures, CONSTRAINT_NAME + undo_rename_column_concurrently :ssh_signatures, :author_email, :committer_email + add_text_limit :ssh_signatures, :author_email, 255, constraint_name: CONSTRAINT_NAME + end +end diff --git a/db/post_migrate/20250717105014_cleanup_author_email_on_ssh_signature_table_rename.rb b/db/post_migrate/20250717105014_cleanup_author_email_on_ssh_signature_table_rename.rb new file mode 100644 index 00000000000000..e23efb84506ae0 --- /dev/null +++ b/db/post_migrate/20250717105014_cleanup_author_email_on_ssh_signature_table_rename.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class CleanupAuthorEmailOnSshSignatureTableRename < Gitlab::Database::Migration[2.3] + milestone '18.3' + disable_ddl_transaction! + + def up + cleanup_concurrent_column_rename :ssh_signatures, :author_email, :committer_email + end + + def down + undo_cleanup_concurrent_column_rename :ssh_signatures, :author_email, :committer_email + end +end diff --git a/db/schema_migrations/20250717081744 b/db/schema_migrations/20250717081744 new file mode 100644 index 00000000000000..0ed056f85504ca --- /dev/null +++ b/db/schema_migrations/20250717081744 @@ -0,0 +1 @@ +70a437ac469ec792bc79dd0da6f832cf2d46648c09d95820e4c1d5d159c33e86 \ No newline at end of file diff --git a/db/schema_migrations/20250717105014 b/db/schema_migrations/20250717105014 new file mode 100644 index 00000000000000..071328dcf3a9c0 --- /dev/null +++ b/db/schema_migrations/20250717105014 @@ -0,0 +1 @@ +f44ac42f30bd8e27d1fb8d9955b4482087086e13d79ace7be45c32c5e2111776 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 5f75a44e60daa3..55283ef99933d5 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -23899,8 +23899,8 @@ CREATE TABLE ssh_signatures ( commit_sha bytea NOT NULL, user_id bigint, key_fingerprint_sha256 bytea, - author_email text, - CONSTRAINT check_5ff707c7f9 CHECK ((char_length(author_email) <= 255)) + committer_email text, + CONSTRAINT check_5ff707c7f9 CHECK ((char_length(committer_email) <= 255)) ); CREATE SEQUENCE ssh_signatures_id_seq -- GitLab