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

(-)a/installer/data/mysql/atomicupdate/bug_24151.perl (+13 lines)
Lines 47-52 if( CheckVersion( $DBversion ) ) { Link Here
47
        VALUES ('PseudonymizationTransactionFields','','datetime,transaction_branchcode,transaction_type,itemnumber,itemtype,holdingbranch,location,itemcallnumber,ccode','Transaction fields to copy to the pseudonymized_transactions table','multiple')
47
        VALUES ('PseudonymizationTransactionFields','','datetime,transaction_branchcode,transaction_type,itemnumber,itemtype,holdingbranch,location,itemcallnumber,ccode','Transaction fields to copy to the pseudonymized_transactions table','multiple')
48
    |);
48
    |);
49
49
50
    unless( TableExists( 'pseudonymized_borrower_attributes' ) ) {
51
        $dbh->do(q|
52
            CREATE TABLE pseudonymized_borrower_attributes (
53
              `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, -- Row id field
54
              `transaction_id` int(11) NOT NULL,
55
              `code` varchar(10) NOT NULL,
56
              `attribute` varchar(255) default NULL,
57
              CONSTRAINT `pseudonymized_borrower_attributes_ibfk_1` FOREIGN KEY (`transaction_id`) REFERENCES `pseudonymized_transactions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
58
              CONSTRAINT `anonymized_borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE
59
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
60
        |);
61
    }
62
50
    # Always end with this (adjust the bug info)
63
    # Always end with this (adjust the bug info)
51
    SetVersion( $DBversion );
64
    SetVersion( $DBversion );
52
    print "Upgrade to $DBversion done (Bug 24151 - Add pseudonymized_transactions tables and sysprefs for Pseudonymization)\n";
65
    print "Upgrade to $DBversion done (Bug 24151 - Add pseudonymized_transactions tables and sysprefs for Pseudonymization)\n";
(-)a/installer/data/mysql/kohastructure.sql (-1 / +14 lines)
Lines 1919-1924 CREATE TABLE `pseudonymized_transactions` ( Link Here
1919
  CONSTRAINT `pseudonymized_transactions_borrowers_ibfk_3` FOREIGN KEY (`transaction_branchcode`) REFERENCES `branches` (`branchcode`)
1919
  CONSTRAINT `pseudonymized_transactions_borrowers_ibfk_3` FOREIGN KEY (`transaction_branchcode`) REFERENCES `branches` (`branchcode`)
1920
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1920
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1921
1921
1922
--
1923
-- Table structure for table borrower_attributes
1924
--
1925
1926
DROP TABLE IF EXISTS pseudonymized_borrower_attributes;
1927
CREATE TABLE pseudonymized_borrower_attributes ( -- association table between pseudonymized_transactions and borrower_attributes
1928
  `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, -- Row id field
1929
  `transaction_id` int(11) NOT NULL,
1930
  `code` varchar(10) NOT NULL, -- foreign key from the borrower_attribute_types table, defines which custom field this value was entered for
1931
  `attribute` varchar(255) default NULL, -- custom patron field value
1932
  CONSTRAINT `pseudonymized_borrower_attributes_ibfk_1` FOREIGN KEY (`transaction_id`) REFERENCES `pseudonymized_transactions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
1933
  CONSTRAINT `anonymized_borrower_attributes_ibfk_2` FOREIGN KEY (`code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE
1934
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1935
1922
--
1936
--
1923
-- Table structure for table subscription_frequencies
1937
-- Table structure for table subscription_frequencies
1924
--
1938
--
1925
- 

Return to bug 24151