Skip to content

monolayer-pg / schema / smallint

Function: smallint()

smallint(): PgSmallint

Column that stores small-range integers.

Returns

PgSmallint

Remarks

Range: -32768 to +32767.

Kysely database schema type definition

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

Nullability and optionality will change according to the column's constraints, generated values, and default data values.

Example

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

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

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

See

smallint (PostgreSQL Docs)