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 1523-1528 CREATE TABLE `borrowers` ( Link Here
1523
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
1523
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
1524
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
1524
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
1525
  `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1525
  `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1526
  `protected` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to mark selected patrons as protected from deletion',
1526
  PRIMARY KEY (`borrowernumber`),
1527
  PRIMARY KEY (`borrowernumber`),
1527
  UNIQUE KEY `cardnumber` (`cardnumber`),
1528
  UNIQUE KEY `cardnumber` (`cardnumber`),
1528
  UNIQUE KEY `userid` (`userid`),
1529
  UNIQUE KEY `userid` (`userid`),
Lines 2650-2655 CREATE TABLE `deletedborrowers` ( Link Here
2650
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
2651
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
2651
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
2652
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
2652
  `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
2653
  `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
2654
  `protected` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to mark selected patrons as protected from deletion',
2653
  KEY `borrowernumber` (`borrowernumber`),
2655
  KEY `borrowernumber` (`borrowernumber`),
2654
  KEY `cardnumber` (`cardnumber`),
2656
  KEY `cardnumber` (`cardnumber`),
2655
  KEY `sms_provider_id` (`sms_provider_id`)
2657
  KEY `sms_provider_id` (`sms_provider_id`)
2656
- 

Return to bug 26170