X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F38-mysql-producer.t;h=25937b81ee9f474bbd25515d20017618030148bd;hb=4d4385499fa84e31f78abe4cacf517e4a11c7b8f;hp=03d9c60adaac3c69fc600e847051b34caa49c4fe;hpb=fb149f8109a6d4cfea3e04a68d40977c55e3e124;p=dbsrgits%2FSQL-Translator.git diff --git a/t/38-mysql-producer.t b/t/38-mysql-producer.t index 03d9c60..25937b8 100644 --- a/t/38-mysql-producer.t +++ b/t/38-mysql-producer.t @@ -72,6 +72,7 @@ schema: fields: - name name: idx_unique_name + thing2: name: thing2 extra: @@ -93,6 +94,15 @@ schema: data_type: int order: 2 is_not_null: 1 + indices: + - type: NORMAL + fields: + - id + name: index_1 + - type: NORMAL + fields: + - id + name: index_2 constraints: - type: PRIMARY_KEY fields: @@ -118,8 +128,6 @@ my @stmts = ( `name` varchar(32), `swedish_name` varchar(32) CHARACTER SET swe7, `description` text CHARACTER SET utf8 COLLATE utf8_general_ci, - INDEX (`id`), - INDEX (`name`), PRIMARY KEY (`id`), UNIQUE `idx_unique_name` (`name`) ) Type=InnoDB DEFAULT CHARACTER SET latin1 COLLATE latin1_danish_ci;\n\n", @@ -129,12 +137,13 @@ my @stmts = ( `id` integer, `foo` integer, `foo2` integer, - INDEX (`id`), + INDEX index_1 (`id`), + INDEX index_2 (`id`), INDEX (`foo`), INDEX (`foo2`), PRIMARY KEY (`id`, `foo`), - CONSTRAINT `thing2_fk_thing` FOREIGN KEY (`foo`) REFERENCES `thing` (`id`), - CONSTRAINT `thing2_fk_thing_1` FOREIGN KEY (`foo2`) REFERENCES `thing` (`id`) + CONSTRAINT `fk_thing` FOREIGN KEY (`foo`) REFERENCES `thing` (`id`), + CONSTRAINT `fk_thing_1` FOREIGN KEY (`foo2`) REFERENCES `thing` (`id`) ) Type=InnoDB;\n\n", "SET foreign_key_checks=1;\n\n" @@ -169,10 +178,10 @@ my $mysql_out = join("", @stmts_no_drop); @{$sqlt}{qw/quote_table_names quote_field_names/} = (0,0); $out = $sqlt->translate(\$yaml_in) - or die "Translat eerror:".$sqlt->error; + or die "Translate error:".$sqlt->error; @out = $sqlt->translate(\$yaml_in) - or die "Translat eerror:".$sqlt->error; + or die "Translate error:".$sqlt->error; $mysql_out =~ s/`//g; my @unquoted_stmts = map { s/`//g; $_} @stmts_no_drop; eq_or_diff $out, $mysql_out, "Output looks right without quoting";