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

(-)a/installer/data/mysql/atomicupdate/bug_24296.perl (+45 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
4
    # Add stockrotation states to reason enum
5
    $dbh->do(
6
        qq{
7
            ALTER TABLE
8
                `branchtransfers`
9
            MODIFY COLUMN
10
                `reason` enum(
11
                    'Manual',
12
                    'StockrotationAdvance',
13
                    'StockrotationRepatriation'
14
                )
15
            AFTER `comments`
16
          }
17
    );
18
19
    # Move stockrotation states to reason field
20
    $dbh->do(
21
        qq{
22
            UPDATE
23
              `branchtransfers`
24
            SET
25
              `reason` = 'StockrotationAdvance',
26
              `comments` = NULL
27
            WHERE
28
              `comments` = 'StockrotationAdvance'
29
          }
30
    );
31
    $dbh->do(
32
        qq{
33
            UPDATE
34
              `branchtransfers`
35
            SET
36
              `reason` = 'StockrotationRepatriation',
37
              `comments` = NULL
38
            WHERE
39
              `comments` = 'StockrotationRepatriation'
40
          }
41
    );
42
43
    SetVersion( $DBversion );
44
    print "Upgrade to $DBversion done (Bug 24296 - Update stockrotation to use 'reason' field in transfers table)\n";
45
}
(-)a/installer/data/mysql/kohastructure.sql (-2 / +1 lines)
Lines 951-957 CREATE TABLE `branchtransfers` ( -- information for items that are in transit be Link Here
951
  `datearrived` datetime default NULL, -- the date the transfer arrived at its destination
951
  `datearrived` datetime default NULL, -- the date the transfer arrived at its destination
952
  `tobranch` varchar(10) NOT NULL default '', -- the branch the transfer was going to
952
  `tobranch` varchar(10) NOT NULL default '', -- the branch the transfer was going to
953
  `comments` LONGTEXT, -- any comments related to the transfer
953
  `comments` LONGTEXT, -- any comments related to the transfer
954
  `reason` ENUM('Manual'), -- what triggered the transfer
954
  `reason` ENUM('Manual', 'StockrotationAdvance', 'StockrotationRepatriation'), -- what triggered the transfer
955
  PRIMARY KEY (`branchtransfer_id`),
955
  PRIMARY KEY (`branchtransfer_id`),
956
  KEY `frombranch` (`frombranch`),
956
  KEY `frombranch` (`frombranch`),
957
  KEY `tobranch` (`tobranch`),
957
  KEY `tobranch` (`tobranch`),
958
- 

Return to bug 24296