Skip to content

Commit

Permalink
Assert current behaviour with clashing index names
Browse files Browse the repository at this point in the history
  • Loading branch information
davel committed Apr 8, 2020
1 parent aa48c63 commit b4874ba
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions t/38-mysql-producer.t
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,41 @@ schema:
type: FOREIGN_KEY
fields: foo2
name: fk_thing
thing4:
name: thing4
extra:
order: 4
fields:
id:
name: id
data_type: int
is_primary_key: 0
order: 1
is_foreign_key: 1
foo:
name: foo
data_type: int
order: 2
is_not_null: 1
foo2:
name: foo2
data_type: int
order: 3
is_not_null: 1
constraints:
- type: UNIQUE
fields:
- foo
- foo2
name: foo
- type: PRIMARY_KEY
fields:
- id
- reference_table: thing
type: FOREIGN_KEY
fields: foo
name: foo
EOSCHEMA

my @stmts = (
Expand Down Expand Up @@ -240,6 +275,17 @@ my @stmts = (
CONSTRAINT `fk_thing_3` FOREIGN KEY (`foo2`) REFERENCES `some`.`thing2` (`id`, `foo`)
) ENGINE=InnoDB",

"DROP TABLE IF EXISTS `thing4`",
"CREATE TABLE `thing4` (
`id` integer NOT NULL,
`foo` integer NULL,
`foo2` integer NULL,
INDEX (`foo`),
UNIQUE `foo` (`foo`, `foo2`),
PRIMARY KEY (`id`),
CONSTRAINT `foo` FOREIGN KEY (`foo`) REFERENCES `thing` (`id`)
) ENGINE=InnoDB",

"SET foreign_key_checks=1",

);
Expand Down

0 comments on commit b4874ba

Please sign in to comment.