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

(-)a/installer/data/mysql/atomicupdate/bug18228.perl (+30 lines)
Line 0 Link Here
1
$DBversion = 'XXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    # Add the new columns
4
    $dbh->do(
5
q|ALTER TABLE virtualshelves
6
ADD COLUMN allow_change_from_owner tinyint(1) default 1,
7
ADD COLUMN allow_change_from_others tinyint(1) default 0|
8
    );
9
10
    # Conversion:
11
    # Since we had no readonly lists, change_from_owner is set to true.
12
    # When adding or delete_other was granted, change_from_others is true.
13
    # Note: In my opinion the best choice; there is no exact match.
14
    $dbh->do(
15
q|UPDATE virtualshelves
16
SET allow_change_from_owner = 1,
17
allow_change_from_others = CASE WHEN allow_add=1 OR allow_delete_other=1 THEN 1 ELSE 0 END|
18
    );
19
20
    # Remove the old columns
21
    $dbh->do(
22
q|ALTER TABLE virtualshelves
23
DROP COLUMN allow_add,
24
DROP COLUMN allow_delete_own,
25
DROP COLUMN allow_delete_other|
26
    );
27
28
    SetVersion( $DBversion );
29
    print "Upgrade to $DBversion done (Bug 18228 - Alter table virtualshelves)\n";
30
}
(-)a/installer/data/mysql/kohastructure.sql (-4 / +2 lines)
Lines 2269-2277 CREATE TABLE `virtualshelves` ( -- information about lists (or virtual shelves) Link Here
2269
  `sortfield` varchar(16) default 'title', -- the field this list is sorted on
2269
  `sortfield` varchar(16) default 'title', -- the field this list is sorted on
2270
  `lastmodified` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time the list was last modified
2270
  `lastmodified` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time the list was last modified
2271
  `created_on` datetime NOT NULL, -- creation time
2271
  `created_on` datetime NOT NULL, -- creation time
2272
  `allow_add` tinyint(1) default 0, -- permission for adding entries to list
2272
  `allow_change_from_owner` tinyint(1) default 1, -- can owner change contents?
2273
  `allow_delete_own` tinyint(1) default 1, -- permission for deleting entries frm list that you added yourself
2273
  `allow_change_from_others` tinyint(1) default 0 -- can others change contents?
2274
  `allow_delete_other` tinyint(1) default 0, -- permission for deleting entries from list that another person added
2275
  PRIMARY KEY  (`shelfnumber`),
2274
  PRIMARY KEY  (`shelfnumber`),
2276
  CONSTRAINT `virtualshelves_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL -- no cascaded delete, please see HandleDelBorrower in Members.pm
2275
  CONSTRAINT `virtualshelves_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL -- no cascaded delete, please see HandleDelBorrower in Members.pm
2277
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
2276
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
2278
- 

Return to bug 18228