: catfile($Bin, "t", @create2);
BEGIN {
- maybe_plan(3,
+ maybe_plan(12,
'SQL::Translator::Parser::SQLite',
+ 'SQL::Translator::Parser::MySQL',
'SQL::Translator::Producer::YAML',
);
}
like($out, qr/ALTER TABLE person CHANGE iq/, "Detected altered 'iq' field");
like($out, qr/ALTER TABLE person ADD is_rock_star/,
"Detected missing rock star field");
+
+@cmd = ($sqlt_diff, "$create1=SQLite", "$create1=SQLite");
+$out = `@cmd`;
+
+like($out, qr/There were no differences/, "Properly detected no differences");
+
+my @mysql_create1 = qw(data mysql create.sql);
+my @mysql_create2 = qw(data mysql create2.sql);
+
+my $mysql_create1 = (-d "t")
+ ? catfile($Bin, @mysql_create1)
+ : catfile($Bin, "t", @mysql_create1);
+
+my $mysql_create2 = (-d "t")
+ ? catfile($Bin, @mysql_create2)
+ : catfile($Bin, "t", @mysql_create2);
+
+@cmd = ($sqlt_diff, "$mysql_create1=MySQL", "$mysql_create2=MySQL");
+$out = `@cmd`;
+
+like($out, qr/ALTER TABLE person CHANGE person_id/, "Detected altered 'person_id' field");
+like($out, qr/ALTER TABLE person CHANGE iq/, "Detected altered 'iq' field");
+like($out, qr/ALTER TABLE person CHANGE name/, "Detected altered 'name' field");
+like($out, qr/ALTER TABLE person CHANGE age/, "Detected altered 'age' field");
+like($out, qr/ALTER TABLE person ADD is_rock_star/,
+ "Detected missing rock star field");
+like($out, qr/ALTER TABLE person ADD UNIQUE UC_person_id/,
+ "Detected missing unique constraint");
+like($out, qr/ALTER TABLE person ENGINE=InnoDB;/,
+ "Detected altered table option");
+
+@cmd = ($sqlt_diff, "$mysql_create1=MySQL", "$mysql_create1=MySQL");
+$out = `@cmd`;
+
+like($out, qr/There were no differences/, "Properly detected no differences");