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

(-)a/installer/data/mysql/atomicupdate/bug26170-protected-patrons.pl (+30 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(
11
                q{
12
                ALTER TABLE borrowers ADD COLUMN protected tinyint(1) NOT NULL DEFAULT 0
13
                COMMENT 'boolean flag to mark selected patrons as protected from deletion'
14
                AFTER `primary_contact_method`;
15
            }
16
            );
17
        }
18
        say $out "Added column borrowers.protected";
19
        if ( !column_exists( 'deletedborrowers', 'protected' ) ) {
20
            $dbh->do(
21
                q{
22
                ALTER TABLE deletedborrowers ADD COLUMN protected tinyint(1) NOT NULL DEFAULT 0
23
                COMMENT 'boolean flag to mark selected patrons as protected from deletion'
24
                AFTER `primary_contact_method`;
25
            }
26
            );
27
        }
28
        say $out "Added column deletedborrowers.protected";
29
    },
30
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +2 lines)
Lines 1559-1564 CREATE TABLE `borrowers` ( Link Here
1559
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
1559
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
1560
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
1560
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
1561
  `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1561
  `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
1562
  `protected` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to mark selected patrons as protected from deletion',
1562
  PRIMARY KEY (`borrowernumber`),
1563
  PRIMARY KEY (`borrowernumber`),
1563
  UNIQUE KEY `cardnumber` (`cardnumber`),
1564
  UNIQUE KEY `cardnumber` (`cardnumber`),
1564
  UNIQUE KEY `userid` (`userid`),
1565
  UNIQUE KEY `userid` (`userid`),
Lines 2688-2693 CREATE TABLE `deletedborrowers` ( Link Here
2688
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
2689
  `anonymized` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'flag for data anonymization',
2689
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
2690
  `autorenew_checkouts` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'flag for allowing auto-renewal',
2690
  `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
2691
  `primary_contact_method` varchar(45) DEFAULT NULL COMMENT 'useful for reporting purposes',
2692
  `protected` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'boolean flag to mark selected patrons as protected from deletion',
2691
  KEY `borrowernumber` (`borrowernumber`),
2693
  KEY `borrowernumber` (`borrowernumber`),
2692
  KEY `cardnumber` (`cardnumber`),
2694
  KEY `cardnumber` (`cardnumber`),
2693
  KEY `sms_provider_id` (`sms_provider_id`)
2695
  KEY `sms_provider_id` (`sms_provider_id`)
2694
- 

Return to bug 26170