Skip to content

Commit 3b75ccd

Browse files
committed
Add test that shows incorrect behavior
1 parent a2661f9 commit 3b75ccd

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/WP_SQLite_Translator_Tests.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,37 @@ public function testShowCreateTablePreservesDoubleUnderscoreKeyNames() {
421421
);
422422
}
423423

424+
public function testShowCreateTableLimitsKeyLengths() {
425+
$this->assertQuery(
426+
"CREATE TABLE _tmp__table (
427+
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
428+
`order_id` bigint(20) unsigned DEFAULT NULL,
429+
`meta_key` varchar(255) DEFAULT NULL,
430+
`meta_value` text DEFAULT NULL,
431+
PRIMARY KEY (`id`),
432+
KEY `meta_key_value` (`meta_key`(100),`meta_value`(82)),
433+
KEY `order_id_meta_key_meta_value` (`order_id`,`meta_key`(100),`meta_value`(82))
434+
);"
435+
);
436+
437+
$this->assertQuery(
438+
'SHOW CREATE TABLE _tmp__table;'
439+
);
440+
$results = $this->engine->get_query_results();
441+
$this->assertEquals(
442+
'CREATE TABLE `_tmp__table` (
443+
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
444+
`order_id` bigint(20) unsigned DEFAULT NULL,
445+
`meta_key` varchar(255) DEFAULT NULL,
446+
`meta_value` text DEFAULT NULL,
447+
PRIMARY KEY (`id`),
448+
KEY `order_id_meta_key_meta_value` (`order_id`,`meta_key`(100),`meta_value`(82)),
449+
KEY `meta_key_value` (`meta_key`(100),`meta_value`(82))
450+
);',
451+
$results[0]->{'Create Table'}
452+
);
453+
}
454+
424455
public function testShowCreateTableWithPrimaryKeyColumnsReverseOrdered() {
425456
$this->assertQuery(
426457
'CREATE TABLE `_tmp_table` (

0 commit comments

Comments
 (0)