Field types for SQLite

Having the following options for field types when using SQLite as the database, is very confusing.

image

If I am informed correctly, SQLite has 5 primary storage classes, namely:

  • INTEGER → Maps to INTEGER storage class.
  • REAL or FLOAT → Maps to REAL storage class.
  • TEXT → Maps to TEXT storage class.
  • BLOB or NONE → Maps to BLOB storage class.
  • NUMERIC → Maps to INTEGER, REAL, or TEXT based on input.

Especially when using dates and times, one would be inclined to use one of the dates and/or time types. This would create the following error message

"Cannot read properties of undefined (reading 'toISOString')"

We use generic data types based on Knex that map to the specific database native data types.

So if the database support the date type than it is used, if not like in SQLite than the text type is used so all dates are stored in text which is common practice in SQLite.

Our date formatters work on text types just fine so they won’t throw any errors.

Thanks @George, that's what I thought was the case.

I will turn this request into a bug report.

This is un-effing-believable! Spent two whole days trying to figure out what was going wrong and kept getting an error message.

Merely changed the types back to date and time to show the assumed bug and all is well.

I guess age is creeping up very rapidly :older_man:

1 Like

Probably your text field was NULL so it couldn’t be converted to iso date. If you expect null you might want to convert it to empty string as default but if you then convert that to date you will get the current date, so not sure if that is what you want

As default I add 0000-00-00 for the date and 00:00 for the time. No problem anymore.