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

(-)a/installer/data/mysql/atomicupdate/bug_30449.pl (+23 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => 30449,
5
    description => "Check borrower_attribute_types FK constraint",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
        if( foreign_key_exists('borrower_attribute_types', 'category_code_fk') ) {
11
            $dbh->do( q|ALTER TABLE borrower_attribute_types DROP CONSTRAINT category_code_fk| );
12
            if( index_exists('borrower_attribute_types', 'category_code_fk') ) {
13
                $dbh->do( q|ALTER TABLE borrower_attribute_types DROP INDEX category_code_fk| );
14
            }
15
        }
16
        if( !foreign_key_exists('borrower_attribute_types', 'borrower_attribute_types_ibfk_1') ) {
17
            if( !index_exists('borrower_attribute_types', 'category_code') ) {
18
                $dbh->do( q|ALTER TABLE borrower_attribute_types ADD INDEX category_code (category_code)| );
19
            }
20
            $dbh->do( q|ALTER TABLE borrower_attribute_types ADD CONSTRAINT borrower_attribute_types_ibfk_1 FOREIGN KEY (`category_code`) REFERENCES `categories` (`categorycode`)| );
21
        }
22
    },
23
};
(-)a/installer/data/mysql/kohastructure.sql (-2 / +3 lines)
Lines 1124-1130 CREATE TABLE `borrower_attribute_types` ( Link Here
1124
  `keep_for_pseudonymization` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is copied to anonymized_borrower_attributes (1 for yes, 0 for no)',
1124
  `keep_for_pseudonymization` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is copied to anonymized_borrower_attributes (1 for yes, 0 for no)',
1125
  `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1125
  `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not',
1126
  PRIMARY KEY (`code`),
1126
  PRIMARY KEY (`code`),
1127
  KEY `auth_val_cat_idx` (`authorised_value_category`)
1127
  KEY `auth_val_cat_idx` (`authorised_value_category`),
1128
  KEY `category_code` (`category_code`),
1129
  CONSTRAINT `borrower_attribute_types_ibfk_1` FOREIGN KEY (`category_code`) REFERENCES `categories` (`categorycode`)
1128
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1130
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1129
/*!40101 SET character_set_client = @saved_cs_client */;
1131
/*!40101 SET character_set_client = @saved_cs_client */;
1130
1132
1131
- 

Return to bug 30449