Skip to content

monolayer / 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 | PgUnmanagedCheck)[]

constraints.foreignKeys?

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

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> | PgUnmanagedIndex)[] : never

triggers?

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