SQLite is not easy to use with migrations, because it doesn't support many ALTER TABLE options [1]: you need to create a new table instead of modifying a column, for example. Also, foreign keys are ignored by default and you need to explicitly enable them after connecting.
Also, column types are not checked and you can easily insert a string into numeric column.
Also it doesn't allow you to use multiple application servers.
SQLite attempts to coerce the data into the appropriate type using the usual affinity rules, as PostgreSQL, MySQL, SQL Server, and Oracle all do. If the value cannot be losslessly converted in the specified datatype, then an SQLITE_CONSTRAINT_DATATYPE error is raised.
To clarify the bit about coercion: "SQLite attempts to coerce the data into the appropriate type using the usual affinity rules, as PostgreSQL, MySQL, SQL Server, and Oracle all do."
Worth mentioning that numeric in Sqlite is still just a float.[0] A table of two rows where column a is 0.1 and 0.2, respectively, sum(a) will not yield 0.3.
In Microsoft SQL Server you should use MONEY or DECIMAL.
In Oracle you should use NUMBER.
In Postgres you should use MONEY or NUMERIC.
In MySQL you should use NUMERIC or DECIMAL.
In IBM DB2 you should use DECIMAL.
These are all backed by integer data storage and arithmetic, but the database handles scaling the values for you, to whatever number of decimal places you have configured. SQL Server and Postgres MONEY type will additionally format values with a currency symbol, when converted to a character string.
In SQLite you're out of luck - if you want accounting values you'll have to store them as integers and scale the values yourself.
Source: I work on a mobile app with offline storage of pricing and weighed quantities, using SQLite in the app, and SQL Server on the back end.
You should still not use MONEY in Postgres, even their own website says so [1].
I still wouldn't use floats/numerics/decimals to store currency either in any db generally, as said by others you're going to end up with inaccurate numbers [2].
Therefore using integers is in fact very good for this use-case, especially if you are in accounting or book-keeping!
Source: I work for a Fintech company that processes millions of payments.
At Prisma, the "twelve easy steps" for performing a table change in SQLite documented on https://sqlite.org/lang_altertable.html is a bit of a running joke.
SQLite is super versatile, but very different from other more traditional RDMBS.
A bit of unfair comment. These steps apply only to ALTER statements that are NOT supported natively by SQLite.
The natively supported statements are as easy to perform as in MySQL or Postgres, for example.
> "The only schema altering commands directly supported by SQLite are the 'rename table', 'rename column', 'add column', 'drop column' commands shown above. However, applications can make other arbitrary changes to the format of a table using a simple sequence of operations.
> Also it doesn't allow you to use multiple application servers.
Not in the same way you use postgres etc, but you can do it with sharding or with LiteFS, but you do have to consider carefully how you scale your app.
I'm not _really_ disagreeing with you, but I think you're painting with a bit too broad of a brush.
There's a workaround for the alter table flaw, but it's a bit involved and takes longer - create a new table with the updated fields, move all data, remove old table, rename the new table. I'm sure there's a historical or valid reason for it, it's just annoying.
Not a solid guarantee. More prone to bugs, errors, etc. What is someone changes something using the comnandline client and forgets to issue the pragma command?
I would feel a lot happier using SQLite if this was a per DB setting rather than a per connection one.
Judging by the documentation, if you issue a PRAGMA foreign_keys; and no row is returned containing a 0 or 1, then you are using an unsupported version of SQLite, or the library was compiled with foreign key support disabled. I am struggling to find any documentation that states if anything will occur if enabling foreign keys in the connection string, when the version does not support foreign keys.
It’s also only two years old which is forever in the web world and brand new by Databases ops/maturity standards. There are likely still warts waiting to be discovered (there always are, but the discovery rate tapers over decades).
Also, column types are not checked and you can easily insert a string into numeric column.
Also it doesn't allow you to use multiple application servers.
So it can be used only with small, simple sites.
[1] https://www.sqlite.org/lang_altertable.html