diff --git a/app/models/commit_signatures/gpg_signature.rb b/app/models/commit_signatures/gpg_signature.rb index 7422ccd380531e04def8e88dc88b13814f10f1a2..8876a38039ed32a3828b6a417c218242bf2f9cc1 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 0000000000000000000000000000000000000000..d82980a4a5997e712fb9660be92fd10f92e32c4c --- /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 0000000000000000000000000000000000000000..67c3db758c32374196ca106dde2555d2ff52dd93 --- /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 0000000000000000000000000000000000000000..19885dec642d4c6b6840013abc02bea23197f574 --- /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 0000000000000000000000000000000000000000..c7b02859f886b25d8f5f67b9e37924d3389ec75f --- /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 a4d96545803bdae8028487ff880fddc017e8af58..ddf3e9e4fa12add931d6e702ebdace2a4d46b893 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