diff --git a/tests/WP_SQLite_Translator_Tests.php b/tests/WP_SQLite_Translator_Tests.php index 44ad3be..3005802 100644 --- a/tests/WP_SQLite_Translator_Tests.php +++ b/tests/WP_SQLite_Translator_Tests.php @@ -704,13 +704,15 @@ public function testCreateTableSpatialIndex() { $this->assertEquals( 1, $result ); } - public function testCreateTableWithDecimalColumn() { + public function testCreateTableWithMultiValueColumnTypeModifiers() { $result = $this->assertQuery( - 'CREATE TABLE wptests_users ( + "CREATE TABLE wptests_users ( ID bigint(20) unsigned NOT NULL auto_increment, decimal_column DECIMAL(10,2) NOT NULL DEFAULT 0, + float_column FLOAT(10,2) NOT NULL DEFAULT 0, + enum_column ENUM('a', 'b', 'c') NOT NULL DEFAULT 'a', PRIMARY KEY (ID), - )' + )" ); $this->assertEquals( '', $this->engine->get_error_message() ); $this->assertEquals( 1, $result ); @@ -735,6 +737,22 @@ public function testCreateTableWithDecimalColumn() { 'Default' => 0, 'Extra' => '', ), + (object) array( + 'Field' => 'float_column', + 'Type' => 'float(10,2)', + 'Null' => 'NO', + 'Key' => '', + 'Default' => 0, + 'Extra' => '', + ), + (object) array( + 'Field' => 'enum_column', + 'Type' => "enum('a','b','c')", + 'Null' => 'NO', + 'Key' => '', + 'Default' => 'a', + 'Extra' => '', + ), ), $results ); diff --git a/wp-includes/sqlite/class-wp-sqlite-translator.php b/wp-includes/sqlite/class-wp-sqlite-translator.php index 604301a..86d7956 100644 --- a/wp-includes/sqlite/class-wp-sqlite-translator.php +++ b/wp-includes/sqlite/class-wp-sqlite-translator.php @@ -65,6 +65,7 @@ class WP_SQLite_Translator { 'double' => 'real', 'decimal' => 'real', 'dec' => 'real', + 'enum' => 'text', 'numeric' => 'real', 'fixed' => 'real', 'date' => 'text',