diff --git a/tests/WP_SQLite_Translator_Tests.php b/tests/WP_SQLite_Translator_Tests.php index 20bc152e..90fcac87 100644 --- a/tests/WP_SQLite_Translator_Tests.php +++ b/tests/WP_SQLite_Translator_Tests.php @@ -421,6 +421,37 @@ public function testShowCreateTablePreservesDoubleUnderscoreKeyNames() { ); } + public function testShowCreateTableLimitsKeyLengths() { + $this->assertQuery( + "CREATE TABLE _tmp__table ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `order_id` bigint(20) unsigned DEFAULT NULL, + `meta_key` varchar(255) DEFAULT NULL, + `meta_value` text DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `meta_key_value` (`meta_key`(100),`meta_value`(82)), + KEY `order_id_meta_key_meta_value` (`order_id`,`meta_key`(100),`meta_value`(82)) + );" + ); + + $this->assertQuery( + 'SHOW CREATE TABLE _tmp__table;' + ); + $results = $this->engine->get_query_results(); + $this->assertEquals( + 'CREATE TABLE `_tmp__table` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `order_id` bigint(20) unsigned DEFAULT NULL, + `meta_key` varchar(255) DEFAULT NULL, + `meta_value` text DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `order_id_meta_key_meta_value` (`order_id`,`meta_key`(100),`meta_value`(82)), + KEY `meta_key_value` (`meta_key`(100),`meta_value`(82)) +);', + $results[0]->{'Create Table'} + ); + } + public function testShowCreateTableWithPrimaryKeyColumnsReverseOrdered() { $this->assertQuery( 'CREATE TABLE `_tmp_table` (