import { kysely } from "https://dotland.deno.dev/x/kysely_postgrs_js_dialect@v0.27.3/deps.ts";
const { ColumnDefinitionBuilder } = kysely;
Adds a default value constraint for the column.
Examples
db.schema
.createTable('pet')
.addColumn('number_of_legs', 'integer', (col) => col.defaultTo(4))
.execute()
Values passed to defaultTo
are interpreted as value literals by default. You can define
an arbitrary SQL expression using the sql template tag:
import { sql } from 'kysely'
db.schema
.createTable('pet')
.addColumn(
'number_of_legs',
'integer',
(col) => col.defaultTo(sql`any SQL here`)
)
.execute()