Skip to contents

Define a basic column for a database table

Usage

Column(
  type,
  default = NULL,
  primary_key = NULL,
  nullable = NULL,
  unique = NULL,
  ...
)

Arguments

type

SQL data type (e.g. "INTEGER", "TEXT", "DATE")

default

Optional default value (no SQL default if NULL)

primary_key

Logical, whether this is part of the primary key. NULL (default) means unspecified.

nullable

Logical, whether NULLs are allowed. NULL (default) means unspecified.

unique

Logical, whether the column has a UNIQUE constraint. NULL (default) means unspecified.

...

Reserved for extras like CHECK, COLLATE, etc.

Value

A Column object

Details

When `primary_key`, `nullable`, or `unique` are set to NULL, the behavior is left to the database system's defaults or determined by higher-level functions. This allows for flexible column definitions and supports composite primary keys.