diff --git a/db/migrate/20230925104848_strip_whitespace_from_batch_invitation_user_name.rb b/db/migrate/20230925104848_strip_whitespace_from_batch_invitation_user_name.rb new file mode 100644 index 0000000000..bb2a698042 --- /dev/null +++ b/db/migrate/20230925104848_strip_whitespace_from_batch_invitation_user_name.rb @@ -0,0 +1,7 @@ +class StripWhitespaceFromBatchInvitationUserName < ActiveRecord::Migration[7.0] + def change + BatchInvitationUser.where("name REGEXP ? OR name REGEXP ?", "^\\s+", "\\s+$").each do |u| + u.update_attribute(:name, u.name&.strip) # rubocop:disable Rails/SkipsModelValidations + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 6698c20fc2..f67b8819f3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_09_25_104847) do +ActiveRecord::Schema[7.0].define(version: 2023_09_25_104848) do create_table "batch_invitation_application_permissions", id: :integer, charset: "utf8mb3", force: :cascade do |t| t.integer "batch_invitation_id", null: false t.integer "supported_permission_id", null: false