summaryrefslogtreecommitdiff
path: root/db/migrate/20220629220129_increase_webauthn_xid_length.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-07-20 15:40:28 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-07-20 15:40:28 +0000
commitb595cb0c1dec83de5bdee18284abe86614bed33b (patch)
tree8c3d4540f193c5ff98019352f554e921b3a41a72 /db/migrate/20220629220129_increase_webauthn_xid_length.rb
parent2f9104a328fc8a4bddeaa4627b595166d24671d0 (diff)
downloadgitlab-ce-b595cb0c1dec83de5bdee18284abe86614bed33b.tar.gz
Add latest changes from gitlab-org/gitlab@15-2-stable-eev15.2.0-rc42
Diffstat (limited to 'db/migrate/20220629220129_increase_webauthn_xid_length.rb')
-rw-r--r--db/migrate/20220629220129_increase_webauthn_xid_length.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20220629220129_increase_webauthn_xid_length.rb b/db/migrate/20220629220129_increase_webauthn_xid_length.rb
new file mode 100644
index 00000000000..c5b107ce3f6
--- /dev/null
+++ b/db/migrate/20220629220129_increase_webauthn_xid_length.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class IncreaseWebauthnXidLength < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ def up
+ new_constraint_name = check_constraint_name(:webauthn_registrations, :credential_xid, 'max_length_v3')
+ add_text_limit :webauthn_registrations, :credential_xid, 1364, constraint_name: new_constraint_name
+
+ prev_constraint_name = check_constraint_name(:webauthn_registrations, :credential_xid, 'max_length_v2')
+ remove_text_limit :webauthn_registrations, :credential_xid, constraint_name: prev_constraint_name
+ end
+
+ def down
+ # no-op: Danger of failling if there are records with length(credential_xid) > 1364
+ end
+end