577
601
# #############################################################################
578
# Test remove_secondary_indexes().
579
# #############################################################################
581
my ( $file, $des, $new_ddl, $indexes ) = @_;
582
my $ddl = load_file($file);
583
my ($got_new_ddl, $got_indexes) = $tp->remove_secondary_indexes($ddl);
587
"$des - secondary indexes $file"
592
"$des - new ddl $file"
598
't/lib/samples/t1.sql',
599
'MyISAM table, no indexes',
601
`a` int(11) default NULL
602
) ENGINE=MyISAM DEFAULT CHARSET=latin1
608
't/lib/samples/one_key.sql',
609
'MyISAM table, one pk',
611
`a` int(11) NOT NULL,
612
`b` char(50) default NULL,
614
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
620
't/lib/samples/date.sql',
622
"CREATE TABLE `checksum_test_5` (
624
`b` int(11) default NULL,
626
) ENGINE=InnoDB DEFAULT CHARSET=latin1
632
't/lib/samples/auto-increment-actor.sql',
633
'pk, key (no trailing comma)',
634
"CREATE TABLE `actor` (
635
`actor_id` smallint(5) unsigned NOT NULL auto_increment,
636
`first_name` varchar(45) NOT NULL,
637
`last_name` varchar(45) NOT NULL,
638
`last_update` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
639
PRIMARY KEY (`actor_id`)
640
) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=utf8;
642
'ADD KEY `idx_actor_last_name` (`last_name`)'
646
't/lib/samples/one_fk.sql',
647
'key, fk, no clustered key',
649
`a` int(11) NOT NULL,
650
`b` char(50) default NULL,
651
CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t2` (`a`)
652
) ENGINE=InnoDB DEFAULT CHARSET=latin1
658
't/lib/samples/sakila.film.sql',
660
"CREATE TABLE `film` (
661
`film_id` smallint(5) unsigned NOT NULL auto_increment,
662
`title` varchar(255) NOT NULL,
664
`release_year` year(4) default NULL,
665
`language_id` tinyint(3) unsigned NOT NULL,
666
`original_language_id` tinyint(3) unsigned default NULL,
667
`rental_duration` tinyint(3) unsigned NOT NULL default '3',
668
`rental_rate` decimal(4,2) NOT NULL default '4.99',
669
`length` smallint(5) unsigned default NULL,
670
`replacement_cost` decimal(5,2) NOT NULL default '19.99',
671
`rating` enum('G','PG','PG-13','R','NC-17') default 'G',
672
`special_features` set('Trailers','Commentaries','Deleted Scenes','Behind the Scenes') default NULL,
673
`last_update` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
674
PRIMARY KEY (`film_id`),
675
CONSTRAINT `fk_film_language` FOREIGN KEY (`language_id`) REFERENCES `language` (`language_id`) ON UPDATE CASCADE,
676
CONSTRAINT `fk_film_language_original` FOREIGN KEY (`original_language_id`) REFERENCES `language` (`language_id`) ON UPDATE CASCADE
677
) ENGINE=InnoDB DEFAULT CHARSET=utf8
679
'ADD KEY `idx_fk_original_language_id` (`original_language_id`), ADD KEY `idx_fk_language_id` (`language_id`), ADD KEY `idx_title` (`title`)'
683
't/lib/samples/issue_729.sql',
685
"CREATE TABLE `posts` (
686
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
687
`template_id` smallint(5) unsigned NOT NULL DEFAULT '0',
688
`other_id` bigint(20) unsigned NOT NULL DEFAULT '0',
689
`date` int(10) unsigned NOT NULL DEFAULT '0',
690
`private` tinyint(3) unsigned NOT NULL DEFAULT '0',
692
) ENGINE=InnoDB AUTO_INCREMENT=15417 DEFAULT CHARSET=latin1;
694
'ADD KEY `other_id` (`other_id`)',
698
't/lib/samples/00_geodb_coordinates.sql',
700
"CREATE TABLE `geodb_coordinates` (
701
`loc_id` int(11) NOT NULL default '0',
702
`lon` double default NULL,
703
`lat` double default NULL,
704
`sin_lon` double default NULL,
705
`sin_lat` double default NULL,
706
`cos_lon` double default NULL,
707
`cos_lat` double default NULL,
708
`coord_type` int(11) NOT NULL default '0',
709
`coord_subtype` int(11) default NULL,
710
`valid_since` date default NULL,
711
`date_type_since` int(11) default NULL,
712
`valid_until` date NOT NULL default '0000-00-00',
713
`date_type_until` int(11) NOT NULL default '0'
714
) ENGINE=InnoDB DEFAULT CHARSET=latin1",
715
'ADD KEY `coord_lon_idx` (`lon`), ADD KEY `coord_loc_id_idx` (`loc_id`), ADD KEY `coord_stype_idx` (`coord_subtype`), ADD KEY `coord_until_idx` (`valid_until`), ADD KEY `coord_lat_idx` (`lat`), ADD KEY `coord_slon_idx` (`sin_lon`), ADD KEY `coord_clon_idx` (`cos_lon`), ADD KEY `coord_slat_idx` (`sin_lat`), ADD KEY `coord_clat_idx` (`cos_lat`), ADD KEY `coord_type_idx` (`coord_type`), ADD KEY `coord_since_idx` (`valid_since`)',
718
# Column and index names are case-insensitive so remove_secondary_indexes()
719
# returns "ADD KEY `foo_bar` (`i`,`j`)" for "KEY `Foo_Bar` (`i`,`J`)".
721
't/lib/samples/issue_956.sql',
724
`i` int(11) default NULL,
725
`J` int(11) default NULL
728
'ADD KEY `foo_bar` (`i`,`j`)',
731
# #############################################################################
733
603
# #############################################################################
735
605
skip 'Cannot connect to sandbox master', 8 unless $dbh;