5 description => "Check borrower_attribute_types FK constraint",
8 my ($dbh, $out) = @$args{qw(dbh out)};
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| );
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)| );
20 $dbh->do( q|ALTER TABLE borrower_attribute_types ADD CONSTRAINT borrower_attribute_types_ibfk_1 FOREIGN KEY (`category_code`) REFERENCES `categories` (`categorycode`)| );