Add renamed_from to tables.
[dbsrgits/SQL-Translator.git] / t / 30sqlt-new-diff-mysql.t
index 0927d7d..a4cca87 100644 (file)
@@ -49,10 +49,12 @@ CREATE TABLE added (
 SET foreign_key_checks=1;
 
 
+ALTER TABLE old_name RENAME TO new_name;
 ALTER TABLE employee DROP FOREIGN KEY FK5302D47D93FE702E;
 ALTER TABLE person DROP UNIQUE UC_age_name;
 ALTER TABLE person DROP INDEX u_name;
 ALTER TABLE employee DROP COLUMN job_title;
+ALTER TABLE new_name ADD COLUMN new_field integer;
 ALTER TABLE person ADD COLUMN is_rock_star tinyint(4) DEFAULT '1';
 ALTER TABLE person CHANGE COLUMN person_id person_id integer(11) NOT NULL auto_increment;
 ALTER TABLE person CHANGE COLUMN name name varchar(20) NOT NULL;
@@ -92,6 +94,8 @@ SET foreign_key_checks=1;
 
 
 ALTER TABLE employee DROP COLUMN job_title;
+ALTER TABLE old_name RENAME TO new_name,
+                     ADD COLUMN new_field integer;
 ALTER TABLE person DROP UNIQUE UC_age_name,
                    ADD COLUMN is_rock_star tinyint(4) DEFAULT '1',
                    CHANGE COLUMN person_id person_id integer(11) NOT NULL auto_increment,
@@ -125,6 +129,9 @@ eq_or_diff($out, <<'## END OF DIFF', "No differences found");
     or die $tr->error;
   my $out = $t->translate( catfile($Bin, qw/data mysql create.sql/ ) )
     or die $tr->error;
+
+  # Lets remove the renamed table so we dont have to change the SQL or other tests
+  $target_schema->drop_table('new_name');
   
   my $schema = $t->schema;
   unless ( $schema->name ) {