diff options
Diffstat (limited to 'packages/db/src/utils.ts')
-rw-r--r-- | packages/db/src/utils.ts | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/packages/db/src/utils.ts b/packages/db/src/utils.ts index 4e1a18685..7a98cca35 100644 --- a/packages/db/src/utils.ts +++ b/packages/db/src/utils.ts @@ -1,2 +1,11 @@ export { defineDbIntegration } from './core/utils.js'; -export { asDrizzleTable } from './runtime/index.js'; +import { tableSchema } from './core/schemas.js'; +import type { ColumnsConfig, TableConfig } from './core/types.js'; +import { type Table, asDrizzleTable as internal_asDrizzleTable } from './runtime/index.js'; + +export function asDrizzleTable< + TableName extends string = string, + TColumns extends ColumnsConfig = ColumnsConfig, +>(name: TableName, tableConfig: TableConfig<TColumns>) { + return internal_asDrizzleTable(name, tableSchema.parse(tableConfig)) as Table<TableName, TColumns>; +} |