16 lines
423 B
TypeScript
16 lines
423 B
TypeScript
import { SiteSchema } from '#database/schema'
|
|
import { column } from '@adonisjs/lucid/orm'
|
|
|
|
/**
|
|
* SQLite stores booleans as 0/1: convert them back when reading.
|
|
*/
|
|
const toBoolean = (value: unknown) => (value === null ? null : Boolean(value))
|
|
|
|
export default class Site extends SiteSchema {
|
|
@column({ consume: toBoolean })
|
|
declare active: boolean
|
|
|
|
@column({ consume: toBoolean })
|
|
declare lastOk: boolean | null
|
|
}
|