Bug 28489: Modify sessions.a_session from longtext to longblob
authorJulian Maurice <julian.maurice@biblibre.com>
Wed, 2 Jun 2021 14:05:17 +0000 (16:05 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 14 Jun 2021 15:35:19 +0000 (17:35 +0200)
This column contains serialized data, it should be a blob.
And it fixes encoding issues.

Test plan:
1. Apply patch and run updatedatabase
2. In $KOHA_CONF make sure that you have
   <strict_sql_modes>0</strict_sql_modes>
3. Create 2 libraries:
  a. TESTÄ/Testä
  b. TEST✓/Test✓
4. Go to the staff interface, change your library to Testä, then
   navigate to a few other pages, make sure there is no encoding problem
   with the library name in the top right corner
5. Do the same with Test✓

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Andrew Nugged <nugged@gmail.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
installer/data/mysql/atomicupdate/sessions-from-longtext-to-longblob.perl [new file with mode: 0644]

diff --git a/installer/data/mysql/atomicupdate/sessions-from-longtext-to-longblob.perl b/installer/data/mysql/atomicupdate/sessions-from-longtext-to-longblob.perl
new file mode 100644 (file)
index 0000000..0ddca85
--- /dev/null
@@ -0,0 +1,8 @@
+$DBversion = 'XXX';
+if ( CheckVersion($DBversion) ) {
+    $dbh->do('DELETE FROM sessions');
+    $dbh->do('ALTER TABLE sessions MODIFY a_session LONGBLOB NOT NULL');
+
+    NewVersion( $DBversion, '28489',
+        'Modify sessions.a_session from longtext to longblob' );
+}