Changes for SQL::Translator
* Add support for monotonically increasing SQLite autoincs (GH#47)
+ * Fix forgotten quoting in the MySQL DROP TABLE diff producer (GH#50)
* Declare dependencies in deterministic order (RT#102859)
- * Multiple speedups of naive internal debugging mechanism
+ * Multiple speedups of naive internal debugging mechanism (GH#54)
* Remove dependency on List::MoreUtils ( http://is.gd/lmu_cac_debacle )
0.11021 2015-01-29
sub drop_table {
my ($table, $options) = @_;
- # Drop (foreign key) constraints so table drops cleanly
- my @sql = batch_alter_table($table, { alter_drop_constraint => [ grep { $_->type eq 'FOREIGN KEY' } $table->get_constraints ] }, $options);
-
- my $table_name = _generator($options)->quote($table);
- return (@sql, "DROP TABLE $table");
-
+ return (
+ # Drop (foreign key) constraints so table drops cleanly
+ batch_alter_table(
+ $table, { alter_drop_constraint => [ grep { $_->type eq 'FOREIGN KEY' } $table->get_constraints ] }, $options
+ ),
+ 'DROP TABLE ' . _generator($options)->quote($table),
+ );
}
sub rename_table {
$s2->name('Schema 4');
my $t1 = $s1->add_table(dclone($target_schema->get_table('employee')));
+ $s1->add_table(dclone($source_schema->get_table('deleted')));
my $t2 = dclone($target_schema->get_table('employee'));
$t2->name('fnord');
$t2->extra(renamed_from => 'employee');
DROP FOREIGN KEY bar_fk,
ADD CONSTRAINT foo_fk FOREIGN KEY (employee_id) REFERENCES foo (id);
+ALTER TABLE deleted DROP FOREIGN KEY fk_fake;
+
+DROP TABLE deleted;
+
COMMIT;
DROP FOREIGN KEY `bar_fk`,
ADD CONSTRAINT `foo_fk` FOREIGN KEY (`employee_id`) REFERENCES `foo` (`id`);
+ALTER TABLE `deleted` DROP FOREIGN KEY `fk_fake`;
+
+DROP TABLE `deleted`;
+
COMMIT;