You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exception thrown from FixedWidthInteger in sqlite-nio / SQLiteDataEncoder.encode in sqlite-kit / FluentSQLiteDatabase.encode in fluent-sqlite-driver.
NIO-SGLTN-0-#0 (3): Fatal error: Not enough bits to represent the passed value
I spent a while debugging this, thinking I hadn't correctly configured the model or migration, only to eventually find that SQLite doesn't support unsigned 64-bit integers.
Given that the database itself does not support the data type, I'd expect some level of the stack to prevent me from doing this at an earlier stage than when I attempt to insert data. Two earlier opportunities that could make sense would be:
When initialising Fluent, with a SQLite database driver, and a model with a UInt64 field.
When running a migration against a SQLite database, setting a field type to UInt64.
Which package should this be solved in? This is certainly debatable. The guiding principle I think should be a good experience for Fluent users. sqlite-kit mostly seems to exist for Fluent, so perhaps in this repo or perhaps in that one. I think sqlite-nio is probably not the right place as it won't be aware of the model or migration layers (I assume?) and therefore probably doesn't have an earlier opportunity to alert the user, that package seems to be doing the right thing with this exception.
Additional notes
No response
The text was updated successfully, but these errors were encountered:
The inability to diagnose this failure mode earlier in the process is an architectural issue inherent to some of Fluent 4's many, many design flaws. Since development of Fluent 4 has essentially ended, the expectation is to fix this in Fluent 5.
Describe the issue
SQLite stores all integers signed, and up to 64 bits wide. Unsigned 64 bit integers therefore do not fit.
Vapor version
4.76.0
Operating system and version
macOS 15.0
Swift version
Swift Package Manager - Swift 6.0.0-dev
Steps to reproduce
UInt64
field type.Outcome
Exception thrown from
FixedWidthInteger
insqlite-nio
/SQLiteDataEncoder.encode
insqlite-kit
/FluentSQLiteDatabase.encode
influent-sqlite-driver
.I spent a while debugging this, thinking I hadn't correctly configured the model or migration, only to eventually find that SQLite doesn't support unsigned 64-bit integers.
Given that the database itself does not support the data type, I'd expect some level of the stack to prevent me from doing this at an earlier stage than when I attempt to insert data. Two earlier opportunities that could make sense would be:
UInt64
field.UInt64
.Which package should this be solved in? This is certainly debatable. The guiding principle I think should be a good experience for Fluent users.
sqlite-kit
mostly seems to exist for Fluent, so perhaps in this repo or perhaps in that one. I thinksqlite-nio
is probably not the right place as it won't be aware of the model or migration layers (I assume?) and therefore probably doesn't have an earlier opportunity to alert the user, that package seems to be doing the right thing with this exception.Additional notes
No response
The text was updated successfully, but these errors were encountered: