View | Details | Raw Unified | Return to bug 21846
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_21846.perl (+26 lines)
Line 0 Link Here
1
$DBversion = 'XXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
4
    $dbh->do('SET FOREIGN_KEY_CHECKS=0');
5
6
    # Change columns accordingly
7
    $dbh->do(q{
8
        ALTER TABLE tags_index
9
            MODIFY COLUMN term VARCHAR(191) COLLATE utf8mb4_bin NOT NULL;
10
    });
11
12
    $dbh->do(q{
13
        ALTER TABLE tags_approval
14
            MODIFY COLUMN term VARCHAR(191) COLLATE utf8mb4_bin NOT NULL;
15
    });
16
17
    $dbh->do(q{
18
        ALTER TABLE tags_all
19
            MODIFY COLUMN term VARCHAR(191) COLLATE utf8mb4_bin NOT NULL;
20
    });
21
22
    $dbh->do('SET FOREIGN_KEY_CHECKS=1');
23
24
    SetVersion( $DBversion );
25
    print "Upgrade to $DBversion done (Bug 21846 - Using emoji as tags has broken weights)\n";
26
}
(-)a/installer/data/mysql/kohastructure.sql (-4 / +3 lines)
Lines 2203-2209 CREATE TABLE `tags_all` ( -- all of the tags Link Here
2203
  `tag_id`         int(11) NOT NULL auto_increment, -- unique id and primary key
2203
  `tag_id`         int(11) NOT NULL auto_increment, -- unique id and primary key
2204
  `borrowernumber` int(11) DEFAULT NULL, -- the patron who added the tag (borrowers.borrowernumber)
2204
  `borrowernumber` int(11) DEFAULT NULL, -- the patron who added the tag (borrowers.borrowernumber)
2205
  `biblionumber`   int(11) NOT NULL, -- the bib record this tag was left on (biblio.biblionumber)
2205
  `biblionumber`   int(11) NOT NULL, -- the bib record this tag was left on (biblio.biblionumber)
2206
  `term`      varchar(255) NOT NULL, -- the tag
2206
  `term`      varchar(191) NOT NULL COLLATE utf8mb4_bin, -- the tag
2207
  `language`       int(4) default NULL, -- the language the tag was left in
2207
  `language`       int(4) default NULL, -- the language the tag was left in
2208
  `date_created` datetime  NOT NULL, -- the date the tag was added
2208
  `date_created` datetime  NOT NULL, -- the date the tag was added
2209
  PRIMARY KEY  (`tag_id`),
2209
  PRIMARY KEY  (`tag_id`),
Lines 2221-2227 CREATE TABLE `tags_all` ( -- all of the tags Link Here
2221
2221
2222
DROP TABLE IF EXISTS `tags_approval`;
2222
DROP TABLE IF EXISTS `tags_approval`;
2223
CREATE TABLE `tags_approval` ( -- approved tags
2223
CREATE TABLE `tags_approval` ( -- approved tags
2224
  `term`   varchar(191) NOT NULL, -- the tag
2224
  `term`   varchar(191) NOT NULL COLLATE utf8mb4_bin, -- the tag
2225
  `approved`     int(1) NOT NULL default '0', -- whether the tag is approved or not (1=yes, 0=pending, -1=rejected)
2225
  `approved`     int(1) NOT NULL default '0', -- whether the tag is approved or not (1=yes, 0=pending, -1=rejected)
2226
  `date_approved` datetime       default NULL, -- the date this tag was approved
2226
  `date_approved` datetime       default NULL, -- the date this tag was approved
2227
  `approved_by` int(11)          default NULL, -- the librarian who approved the tag (borrowers.borrowernumber)
2227
  `approved_by` int(11)          default NULL, -- the librarian who approved the tag (borrowers.borrowernumber)
Lines 2238-2244 CREATE TABLE `tags_approval` ( -- approved tags Link Here
2238
2238
2239
DROP TABLE IF EXISTS `tags_index`;
2239
DROP TABLE IF EXISTS `tags_index`;
2240
CREATE TABLE `tags_index` ( -- a weighted list of all tags and where they are used
2240
CREATE TABLE `tags_index` ( -- a weighted list of all tags and where they are used
2241
  `term`    varchar(191) NOT NULL, -- the tag
2241
  `term`    varchar(191) NOT NULL COLLATE utf8mb4_bin, -- the tag
2242
  `biblionumber` int(11) NOT NULL, -- the bib record this tag was used on (biblio.biblionumber)
2242
  `biblionumber` int(11) NOT NULL, -- the bib record this tag was used on (biblio.biblionumber)
2243
  `weight`        int(9) NOT NULL default '1', -- the number of times this term was used on this bib record
2243
  `weight`        int(9) NOT NULL default '1', -- the number of times this term was used on this bib record
2244
  PRIMARY KEY  (`term`,`biblionumber`),
2244
  PRIMARY KEY  (`term`,`biblionumber`),
2245
- 

Return to bug 21846