From ee68b7c989458f4af192565c935074c4a64a941d Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 3 Sep 2021 11:17:04 -0400 Subject: [PATCH] TT#139652 expand reg_id for kamailio.mobile_push_registrations The format of Android push tokens is a free-form binary string of up to 4096 bytes. Currently the tokens are under 256 bytes long, but we expand the DB field anyway to be future-proof. Unfortunately MySQL doesn't allow keys that long, so we have to restrict the field to 3072 bytes. Further add an auto-increment integer primary key to make InnoDB happy. Change-Id: Ic664d47b80f751397ec51688d8f399da06eac176 (cherry picked from commit 31527c2281df6b9441b74f0f1c5cf94ccada91e8) --- db_scripts/diff/15694.down | 4 ++++ db_scripts/diff/15694.up | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 db_scripts/diff/15694.down create mode 100644 db_scripts/diff/15694.up diff --git a/db_scripts/diff/15694.down b/db_scripts/diff/15694.down new file mode 100644 index 00000000..43683fae --- /dev/null +++ b/db_scripts/diff/15694.down @@ -0,0 +1,4 @@ +ALTER TABLE kamailio.mobile_push_registrations + DROP id, + DROP INDEX reg_token, + MODIFY reg_id VARBINARY(255) NOT NULL PRIMARY KEY; diff --git a/db_scripts/diff/15694.up b/db_scripts/diff/15694.up new file mode 100644 index 00000000..5bb7ca50 --- /dev/null +++ b/db_scripts/diff/15694.up @@ -0,0 +1,5 @@ +ALTER TABLE kamailio.mobile_push_registrations + DROP PRIMARY KEY, + ADD id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, + MODIFY reg_id VARBINARY(3072) NOT NULL, + ADD UNIQUE INDEX reg_token (reg_id);