Schema Types
ColumnDefinition¶
Type: Object
Properties¶
namestring The name of the column.typestring PostgreSQL data type (e.g., 'text', 'uuid', 'integer', 'varchar', 'jsonb').generated("always"|"by default")? Marks the column as a generated column.expressionstring? SQL expression used for the generated column.storedboolean? Whether the generated column should be stored.notNullboolean? Whether the column accepts null values. Defaults to false.defaultany? Default value for the column. Can be a literal or SQL expression.immutableboolean? If true, the column cannot be updated after creation. Defaults to false.-
colPropsObject? Extended column behavior modifiers.
ConstraintDefinition¶
Type: Object
Properties¶
type("PrimaryKey"|"ForeignKey"|"Unique"|"Check"|"Index") Type of constraint.columnsArray<string> List of column names the constraint applies to.references{table: string, columns: Array<string>}? For foreign keys.onDeletestring? Optional ON DELETE behavior (e.g., 'CASCADE').expressionstring? SQL expression for check constraints.
Constraints¶
Type: Object
Properties¶
primaryKeyArray<string>? Column names used as the primary key.uniqueArray<Array<string>>? List of unique constraints (single or composite).foreignKeysArray<ConstraintDefinition>? Array of foreign key definitions.checksArray<ConstraintDefinition>? Array of SQL check expressions.indexesArray<ConstraintDefinition>? Index definitions for query optimization.
AuditFieldsConfig¶
Type: Object
Properties¶
enabledboolean Whether to include audit fields.-
userFieldsObject? Configuration for user tracking fields (created_by, updated_by).
TableSchema¶
Type: Object
Properties¶
dbSchemastring PostgreSQL schema name (e.g., 'public').tablestring Table name.hasAuditFields(boolean | AuditFieldsConfig)? Whether to include created_at/updated_at/by fields. Accepts boolean for backward compatibility or object for configuration.softDeleteboolean? Whether to use a soft delete strategy.versionstring? Optional schema version string.columnsArray<ColumnDefinition> List of column definitions.constraintsConstraints? Table-level constraints.