Schema Types
ColumnDefinition¶
Type: Object
Properties¶
name
string The name of the column.type
string PostgreSQL data type (e.g., 'text', 'uuid', 'integer', 'varchar', 'jsonb').generated
("always"
|"by default"
)? Marks the column as a generated column.expression
string? SQL expression used for the generated column.stored
boolean? Whether the generated column should be stored.notNull
boolean? Whether the column accepts null values. Defaults to false.default
any? Default value for the column. Can be a literal or SQL expression.immutable
boolean? If true, the column cannot be updated after creation. Defaults to false.-
colProps
Object? Extended column behavior modifiers.
ConstraintDefinition¶
Type: Object
Properties¶
type
("PrimaryKey"
|"ForeignKey"
|"Unique"
|"Check"
|"Index"
) Type of constraint.columns
Array<string> List of column names the constraint applies to.references
{table: string, columns: Array<string>}? For foreign keys.onDelete
string? Optional ON DELETE behavior (e.g., 'CASCADE').expression
string? SQL expression for check constraints.
Constraints¶
Type: Object
Properties¶
primaryKey
Array<string>? Column names used as the primary key.unique
Array<Array<string>>? List of unique constraints (single or composite).foreignKeys
Array<ConstraintDefinition>? Array of foreign key definitions.checks
Array<ConstraintDefinition>? Array of SQL check expressions.indexes
Array<ConstraintDefinition>? Index definitions for query optimization.
TableSchema¶
Type: Object
Properties¶
dbSchema
string PostgreSQL schema name (e.g., 'public').table
string Table name.hasAuditFields
boolean? Whether to include created_at/updated_at/by fields.softDelete
boolean? Whether to use a soft delete strategy.version
string? Optional schema version string.columns
Array<ColumnDefinition> List of column definitions.constraints
Constraints? Table-level constraints.