Serialization

Use custom adapters when the public generated API should expose a domain type instead of the raw SQLite storage type.

CREATE TABLE task
(
    id INTEGER PRIMARY KEY NOT NULL,

    -- @@{ field=tags, adapter=custom, propertyType=List<String> }
    tags TEXT NOT NULL
);
let db = AppDatabase(
    path: databaseURL,
    adapters: AppDatabaseAdapters(
        sqlValueToTags: { value in decodeTags(value) },
        tagsToSqlValue: { tags in encodeTags(tags) }
    )
)

Prefer stable serialized values for enums and timestamps. For absolute time, store RFC3339 text with an explicit zone instead of locale-specific strings.