Skip to content

Commit 62896df

Browse files
committed
Add test that reproduces issue with invalid empty date default
1 parent b74ae19 commit 62896df

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/WP_SQLite_Translator_Tests.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,28 @@ public function testShowCreateTable1() {
289289
);
290290
}
291291

292+
public function testShowCreateTableWithEmptyDatetimeDefault() {
293+
$this->assertQuery(
294+
"CREATE TABLE _tmp_table (
295+
ID BIGINT PRIMARY KEY AUTO_INCREMENT NOT NULL,
296+
created_at datetime NOT NULL
297+
);"
298+
);
299+
300+
$this->assertQuery(
301+
'SHOW CREATE TABLE _tmp_table;'
302+
);
303+
$results = $this->engine->get_query_results();
304+
305+
$this->assertEquals(
306+
"CREATE TABLE _tmp_table (
307+
`ID` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL,
308+
`created_at` datetime NOT NULL
309+
);",
310+
$results[0]->{'Create Table'}
311+
);
312+
}
313+
292314
public function testShowCreateTableQuoted() {
293315
$this->assertQuery(
294316
"CREATE TABLE _tmp_table (

0 commit comments

Comments
 (0)