diff --git a/C4/Serials.pm b/C4/Serials.pm
index f85795adf1..c7cbd70a91 100644
--- a/C4/Serials.pm
+++ b/C4/Serials.pm
@@ -428,6 +428,7 @@ sub GetSubscriptionsFromBiblionumber {
} else {
$subs->{histenddate} = "";
}
+ $subs->{opacnote} //= "";
$subs->{opacnote} =~ s/\n/\
/g;
$subs->{missinglist} =~ s/\n/\
/g;
$subs->{recievedlist} =~ s/\n/\
/g;
diff --git a/installer/data/mysql/atomicupdate/bug_10215.perl b/installer/data/mysql/atomicupdate/bug_10215.perl
new file mode 100644
index 0000000000..a960435a24
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_10215.perl
@@ -0,0 +1,9 @@
+$DBversion = 'XXX';
+if ( CheckVersion($DBversion) ) {
+
+ $dbh->do(q{ALTER TABLE subscriptionhistory CHANGE opacnote opacnote LONGTEXT NULL});
+ $dbh->do(q{ALTER TABLE subscriptionhistory CHANGE librariannote librariannote LONGTEXT NULL});
+
+ SetVersion ($DBversion);
+ print "Upgrade to $DBversion done (Bug 10215 - Increase the size of opacnote and librariannote for table subscriptionhistory)\n";
+}
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index bdb4816e74..0354aea9de 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -2146,8 +2146,8 @@ CREATE TABLE `subscriptionhistory` (
`histenddate` date default NULL,
`missinglist` LONGTEXT NOT NULL,
`recievedlist` LONGTEXT NOT NULL,
- `opacnote` varchar(150) NOT NULL default '',
- `librariannote` varchar(150) NOT NULL default '',
+ `opacnote` LONGTEXT NULL,
+ `librariannote` LONGTEXT NULL,
PRIMARY KEY (`subscriptionid`),
KEY `biblionumber` (`biblionumber`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;