monolayer-pg / schema / serial
Function: serial()
serial():
PgSerial
Unique identifier column.
Returns
Remarks
Not a true native PostgreSQL data type. A serial
column is a column that has:
- an
integer
data type. - default values assigned from a sequence generator.
- a
NOT NULL
constraint.
Kysely database schema type definition
ts
{
readonly __select__: number;
readonly __insert__: number | string | undefined;
readonly __update__: number | string;
};
Example
ts
import { schema, serial, table } from "@monolayer/pg/schema";
const dbSchema = schema({
tables: {
example: table({
columns: {
id: serial(),
},
}),
},
});
// Kysely database schema type
type DB = typeof dbSchema.infer;
See
PostgreSQL Docs: serial