Open
Description
Hi,
I've been trying to read a DATETIME
column using an Expressible<Date>
, unfortunately it crashes in Date.fromDatatypeValue
.
(lldb) po stringValue
"2020-02-05 18:10:14"
(lldb) po dateFormatter.date(from: stringValue)
▿ Optional<Date>
▿ some : 2001-01-01 00:00:00 +0000
- timeIntervalSinceReferenceDate : 0.0
I think that SQLite.swift is expecting a Date format which is not the one used by default in SQLite by DATETIME("now")
or CURRENT_TIMESTAMP
.
The problem is that I rely on SQLite to automatically fill my created
and updated
column using CURRENT_TIMESTAMP
, I guess that if I was using Date
through SQLite.swift it would work fine, but I prefer to keep that kind of things in the database.
created DATETIME DEFAULT(CURRENT_TIMESTAMP) NOT NULL
CREATE TRIGGER IF NOT EXISTS trigger_objects_updated AFTER UPDATE ON objects
BEGIN
UPDATE objects SET updated = CURRENT_TIMESTAMP WHERE id = new.id;
END;
Is there any workaround, or should this be fixed in SQLite.swift's dateFormatter
?
Build information: SQLite.swift 0.12.2, Xcode 11.3.1