Skip to content

monolayer-pg / schema / TableDefinition

Type Alias: TableDefinition<T, PK>

TableDefinition<T, PK>: object

Type Parameters

Type Parameter
T
PK extends string

Type declaration

columns?

optional columns: T extends ColumnRecord ? T : never

constraints?

optional constraints: object

constraints.checks?

optional checks: (PgCheck | PgMappedCheck)[]

constraints.foreignKeys?

optional foreignKeys: keyof T extends string ? (PgForeignKey<keyof T, any> | PgSelfReferentialForeignKey<keyof T, any> | PgMappedForeignKey)[] : []

constraints.primaryKey?

optional primaryKey: keyof T extends string ? PK[] extends keyof T[] ? PgPrimaryKey<keyof T, PK> : PgPrimaryKey<keyof T, PK> : never

constraints.unique?

optional unique: keyof T extends string ? PgUnique<keyof T>[] : []

indexes?

optional indexes: keyof T extends string ? (PgIndex<keyof T> | PgMappedIndex)[] : never

triggers?

optional triggers: (PgTrigger<keyof T extends string ? keyof T : never> | PgTrigger<never> | PgMappedTrigger)[]