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 2204-2210 CREATE TABLE `tags_all` ( -- all of the tags Link Here
2204
  `tag_id`         int(11) NOT NULL auto_increment, -- unique id and primary key
2204
  `tag_id`         int(11) NOT NULL auto_increment, -- unique id and primary key
2205
  `borrowernumber` int(11) DEFAULT NULL, -- the patron who added the tag (borrowers.borrowernumber)
2205
  `borrowernumber` int(11) DEFAULT NULL, -- the patron who added the tag (borrowers.borrowernumber)
2206
  `biblionumber`   int(11) NOT NULL, -- the bib record this tag was left on (biblio.biblionumber)
2206
  `biblionumber`   int(11) NOT NULL, -- the bib record this tag was left on (biblio.biblionumber)
2207
  `term`      varchar(255) NOT NULL, -- the tag
2207
  `term`      varchar(191) NOT NULL COLLATE utf8mb4_bin, -- the tag
2208
  `language`       int(4) default NULL, -- the language the tag was left in
2208
  `language`       int(4) default NULL, -- the language the tag was left in
2209
  `date_created` datetime  NOT NULL, -- the date the tag was added
2209
  `date_created` datetime  NOT NULL, -- the date the tag was added
2210
  PRIMARY KEY  (`tag_id`),
2210
  PRIMARY KEY  (`tag_id`),
Lines 2222-2228 CREATE TABLE `tags_all` ( -- all of the tags Link Here
2222
2222
2223
DROP TABLE IF EXISTS `tags_approval`;
2223
DROP TABLE IF EXISTS `tags_approval`;
2224
CREATE TABLE `tags_approval` ( -- approved tags
2224
CREATE TABLE `tags_approval` ( -- approved tags
2225
  `term`   varchar(191) NOT NULL, -- the tag
2225
  `term`   varchar(191) NOT NULL COLLATE utf8mb4_bin, -- the tag
2226
  `approved`     int(1) NOT NULL default '0', -- whether the tag is approved or not (1=yes, 0=pending, -1=rejected)
2226
  `approved`     int(1) NOT NULL default '0', -- whether the tag is approved or not (1=yes, 0=pending, -1=rejected)
2227
  `date_approved` datetime       default NULL, -- the date this tag was approved
2227
  `date_approved` datetime       default NULL, -- the date this tag was approved
2228
  `approved_by` int(11)          default NULL, -- the librarian who approved the tag (borrowers.borrowernumber)
2228
  `approved_by` int(11)          default NULL, -- the librarian who approved the tag (borrowers.borrowernumber)
Lines 2239-2245 CREATE TABLE `tags_approval` ( -- approved tags Link Here
2239
2239
2240
DROP TABLE IF EXISTS `tags_index`;
2240
DROP TABLE IF EXISTS `tags_index`;
2241
CREATE TABLE `tags_index` ( -- a weighted list of all tags and where they are used
2241
CREATE TABLE `tags_index` ( -- a weighted list of all tags and where they are used
2242
  `term`    varchar(191) NOT NULL, -- the tag
2242
  `term`    varchar(191) NOT NULL COLLATE utf8mb4_bin, -- the tag
2243
  `biblionumber` int(11) NOT NULL, -- the bib record this tag was used on (biblio.biblionumber)
2243
  `biblionumber` int(11) NOT NULL, -- the bib record this tag was used on (biblio.biblionumber)
2244
  `weight`        int(9) NOT NULL default '1', -- the number of times this term was used on this bib record
2244
  `weight`        int(9) NOT NULL default '1', -- the number of times this term was used on this bib record
2245
  PRIMARY KEY  (`term`,`biblionumber`),
2245
  PRIMARY KEY  (`term`,`biblionumber`),
2246
- 

Return to bug 21846