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

(-)a/installer/data/mysql/atomicupdate/bug26170-protected-patrons.pl (+26 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "26170",
5
    description => "Create system patrons that cannot be (easily) deleted via the web UI",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        if( !column_exists( 'borrowers', 'protected' ) ) {
10
            $dbh->do(q{
11
                ALTER TABLE borrowers ADD COLUMN protected tinyint(1) NOT NULL DEFAULT 0
12
                COMMENT 'boolean flag to mark selected patrons as protected from deletion'
13
                AFTER `primary_contact_method`;
14
            });
15
        }
16
        say $out "Added column borrowers.protected";
17
        if( !column_exists( 'deletedborrowers', 'protected' ) ) {
18
            $dbh->do(q{
19
                ALTER TABLE deletedborrowers ADD COLUMN protected tinyint(1) NOT NULL DEFAULT 0
20
                COMMENT 'boolean flag to mark selected patrons as protected from deletion'
21
                AFTER `primary_contact_method`;
22
            });
23
        }
24
        say $out "Added column deletedborrowers.protected";
25
    },
26
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +2 lines)
Lines 1542-1547 CREATE TABLE `borrowers` ( Link Here
1542
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
1542
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
1543
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
1543
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
1544
  `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1544
  `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1545
  `protected` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to mark selected patrons as protected from deletion',
1545
  PRIMARY KEY (`borrowernumber`),
1546
  PRIMARY KEY (`borrowernumber`),
1546
  UNIQUE KEY `cardnumber` (`cardnumber`),
1547
  UNIQUE KEY `cardnumber` (`cardnumber`),
1547
  UNIQUE KEY `userid` (`userid`),
1548
  UNIQUE KEY `userid` (`userid`),
Lines 2669-2674 CREATE TABLE `deletedborrowers` ( Link Here
2669
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
2670
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
2670
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
2671
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
2671
  `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
2672
  `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
2673
  `protected` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to mark selected patrons as protected from deletion',
2672
  KEY `borrowernumber` (`borrowernumber`),
2674
  KEY `borrowernumber` (`borrowernumber`),
2673
  KEY `cardnumber` (`cardnumber`),
2675
  KEY `cardnumber` (`cardnumber`),
2674
  KEY `sms_provider_id` (`sms_provider_id`)
2676
  KEY `sms_provider_id` (`sms_provider_id`)
2675
- 

Return to bug 26170