Skip to content

Commit e43782e

Browse files
committed
Add test that reproduces issue with invalid empty date default
1 parent a2661f9 commit e43782e

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
@@ -290,6 +290,28 @@ public function testShowCreateTable1() {
290290
);
291291
}
292292

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

0 commit comments

Comments
 (0)