Releases: Lighter-swift/Lighter
Carriage Returned
Fix for Issue #23, thanks go to @finestructure for reporting it. If the SQL to create a database contained carriage returns (CR, \r
, ASCII 13), Enlighter wouldn't properly generate multiline string literals. This then break Swift compilation.
Fixed. Also converting CRLF to CRs, i.e. no more CRs in produced code.
Binaries Floating
This version treats all Int
types (Int8
, UInt32
etc) as SQLite base values, i.e. they can be used in a schema. Also adds support for Float
.
The Bool
type can now process TEXT columns in a limited way (but always writes as Int64). It'll match textual bools using the first character (Yes, No, True, False, 0, 1 etc).
Finally, when using a RawRepresentable w/ an unmapped stored value, a proper Error is thrown (vs crashing in a forced unwrap).
Macroless
FiveEight.2
Fix an Xcode 14.3/Swift 5.8 warning.
FiveEight
NOTify!
The Truth
Backgrounds
As a convenience the simple pool now releases open SQLite connection when the application did enter background, on iOS. The pool collector now also captures the pool weakly, though that shouldn't matter much in practice.
Also added a few docs here and there.
INTeger
The release improves SQLite compatibility wrt "rowid" primary keys, also called "INTEGER primary keys". If a column is declared as INTEGER PRIMARY KEY
, SQLite will automatically push a row-id as the primary key if no explicit value is specified. Lighter already accounted for that.
It didn't distinguish that though from other integer columns, e.g. if specified as just INT
. A column declared as INT PRIMARY KEY
doesn't support the automatic key assignment (INTEGER
must be spelled out).
This is now properly implemented in the schema reflection and addressed in the generator.
There is another fix related to the generation of plural names in the SQLite API, e.g. the generator generated names like taltents0
if the base name was plural already (and singularizeRecordNames
is off, which is the default).
Initially
New day, new release. 1.0.8 brings a few small fixes and conveniences.
UUID Primary Keys
When using UUID primary keys, like:
CREATE TABLE talent (
talent_id UUID NOT NULL,
name TEXT NOT NULL
);
The generated code now generates a default UUID when none is specified, e.g.:
var talent = Talent(name: "Jason Bourne") // <= no explicit `id` necessary anymore
try db.insert(talent)
Integer Primary Keys
Similar to UUIDs, Integer primary keys improved and default to Int.min
, e.g.:
CREATE TABLE person (
person_id INTEGER PRIMARY KEY NOT NULL,
name TEXT NOT NULL
);
Doesn't require the id
to be specified anymore (it isn't used for INSERTs in any case!):
var person = Person(name: "Jason Bourne") // <= no explicit `id` necessary anymore
try db.insert(person)
Note: There is still a glitch in the form of issue #14. SQLite only does int-key things, if the column was created using INTEGER
, e.g. INT
doesn't work properly.