A declared type of `datetime` gives that attribute NUMERIC affinity, not INTEGER affinity. See <https://sqlite.org/datatype3.html> in particular section 3.1 and the last row in the table at 3.1.1
A declared type of `datetime` gives that attribute NUMERIC affinity, not INTEGER affinity. See <https://sqlite.org/datatype3.html> in particular section 3.1 and the last row in the table at 3.1.1