From: Chris Hilton Date: Wed, 10 Aug 2005 16:55:44 +0000 (+0000) Subject: Added some constraint tests X-Git-Tag: v0.11008~486 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9ae898b9a0ba800f7d2bb44ecaa04680cad14558;p=dbsrgits%2FSQL-Translator.git Added some constraint tests Removed YAML prereq, sqlt-diff doesn't use it anymore --- diff --git a/t/30sqlt-diff.t b/t/30sqlt-diff.t index 95cc3ac..aadab62 100644 --- a/t/30sqlt-diff.t +++ b/t/30sqlt-diff.t @@ -25,10 +25,9 @@ my $create2 = (-d "t") : catfile($Bin, "t", @create2); BEGIN { - maybe_plan(12, + maybe_plan(14, 'SQL::Translator::Parser::SQLite', 'SQL::Translator::Parser::MySQL', - 'SQL::Translator::Producer::YAML', ); } @@ -70,6 +69,10 @@ 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"); +like($out, qr/ALTER TABLE employee DROP FOREIGN KEY/, + "Detected drop foreign key"); +like($out, qr/ALTER TABLE employee ADD CONSTRAINT/, + "Detected add constraint"); @cmd = ($sqlt_diff, "$mysql_create1=MySQL", "$mysql_create1=MySQL"); $out = `@cmd`; diff --git a/t/data/mysql/create.sql b/t/data/mysql/create.sql index 51dbcc7..9802baa 100644 --- a/t/data/mysql/create.sql +++ b/t/data/mysql/create.sql @@ -8,3 +8,10 @@ create table person ( ) ENGINE=MyISAM; create unique index u_name on person (name); + +create table employee ( + position varchar(50), + employee_id integer, + CONSTRAINT FK5302D47D93FE702E FOREIGN KEY (employee_id) REFERENCES person (person_id) +) ENGINE=InnoDB; + diff --git a/t/data/mysql/create2.sql b/t/data/mysql/create2.sql index 8a9e768..57a02d9 100644 --- a/t/data/mysql/create2.sql +++ b/t/data/mysql/create2.sql @@ -10,3 +10,9 @@ create table person ( ) ENGINE=InnoDB; create unique index u_name on person (name); + +create table employee ( + position varchar(50), + employee_id INTEGER, + CONSTRAINT FK5302D47D93FE702E_diff FOREIGN KEY (employee_id) REFERENCES person (person_id) +) ENGINE=InnoDB;