Type Alias JsonSchemaToDrizzleColumns<TObjectType, TSchema, TPrimaryKey>
Type Parameters
- TObjectType extends {
[K in keyof TSchema["properties"]]?: any
} - TSchema extends JSONSchema7Object
- TPrimaryKey extends keyof TSchema["properties"] | undefined = undefined
Convert a JSONSchema Object Schema to a Drizzle Columns map (e.g. parameter for
sqliteTable()
). All top-level properties map to SQLite columns, withrequired
properties marked asNOT NULL
, and JSONSchemadefault
will map to SQLite defaults.Any properties that are of type
object
orarray
in the JSONSchema will be mapped to a text field, which drizzle will parse and stringify. Types forobject
andarray
properties will be derived fromTObjectType
.