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

(-)a/installer/data/mysql/atomicupdate/Bug19520_Add_more_information_to_rotating_collections.perl (+21 lines)
Line 0 Link Here
1
$DBversion = 'XXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
4
    if( !column_exists( 'collections', 'createdBy' ) ) {
5
        $dbh->do( "ALTER TABLE collections ADD COLUMN createdBy int(11) default NULL AFTER colBranchcode" );
6
    }
7
8
    $dbh->do( "ALTER TABLE collections ADD CONSTRAINT `collections_ibfk_2` FOREIGN KEY (`createdBy`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE");
9
10
    if( !column_exists( 'collections', 'createdOn' ) ) {
11
        $dbh->do( "ALTER TABLE collections ADD COLUMN createdOn datetime default NULL AFTER createdBy" );
12
    }
13
14
    if( !column_exists( 'collections', 'lastTransferredOn' ) ) {
15
        $dbh->do( "ALTER TABLE collections ADD COLUMN lastTransferredOn datetime default NULL AFTER createdOn" );
16
    }
17
18
    # Always end with this (adjust the bug info)
19
    SetVersion( $DBversion );
20
    print "Upgrade to $DBversion done (Bug 19520 - Add additional information to rotating collections)\n";
21
}
(-)a/installer/data/mysql/kohastructure.sql (-1 / +6 lines)
Lines 318-323 CREATE TABLE collections ( Link Here
318
  colTitle varchar(100) NOT NULL DEFAULT '',
318
  colTitle varchar(100) NOT NULL DEFAULT '',
319
  colDesc MEDIUMTEXT NOT NULL,
319
  colDesc MEDIUMTEXT NOT NULL,
320
  colBranchcode varchar(10) DEFAULT NULL, -- 'branchcode for branch where item should be held.'
320
  colBranchcode varchar(10) DEFAULT NULL, -- 'branchcode for branch where item should be held.'
321
  createdBy int(11) default NULL,
322
  createdOn datetime default NULL,
323
  lastTransferredOn datetime default NULL,
321
  PRIMARY KEY (colId)
324
  PRIMARY KEY (colId)
322
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
325
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
323
326
Lines 327-332 CREATE TABLE collections ( Link Here
327
ALTER TABLE `collections`
330
ALTER TABLE `collections`
328
  ADD CONSTRAINT `collections_ibfk_1` FOREIGN KEY (`colBranchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE;
331
  ADD CONSTRAINT `collections_ibfk_1` FOREIGN KEY (`colBranchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE;
329
332
333
ALTER TABLE `collections`
334
  ADD CONSTRAINT `collections_ibfk_2` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE;
335
330
--
336
--
331
-- Table structure for table `branch_borrower_circ_rules`
337
-- Table structure for table `branch_borrower_circ_rules`
332
--
338
--
333
- 

Return to bug 19520