Skip to content

monolayer-pg / schema / bigserial

Function: bigserial()

bigserial(): PgBigSerial

Unique identifier column.

Returns

PgBigSerial

Remarks

Not a true native PostgreSQL data type. A bigserial column is a column that has:

  • a bigint data type.
  • default values assigned from a sequence generator.
  • a NOT NULL constraint.

Kysely database schema type definition

ts
{
  readonly __select__: string;
  readonly __insert__: bigint | number | string | undefined;
  readonly __update__: bigint | number | string;
};

Example

ts
import { bigserial, schema, table } from "@monolayer/pg/schema";

const dbSchema = schema({
  tables: {
    example: table({
      columns: {
        id: bigserial(),
      },
    }),
  },
});

// Kysely database schema type
type DB = typeof dbSchema.infer;

See

PostgreSQL Docs: bigserial