From ba61b821cab7f00390463a6723cda9ea1c92ece9 Mon Sep 17 00:00:00 2001 From: prodrigues Date: Fri, 20 Sep 2024 15:37:50 +0100 Subject: [PATCH] keeping DrizzleConfig Mode type --- drizzle-orm/src/monodriver.ts | 5 ++--- drizzle-orm/src/monomigrator.ts | 6 +++--- drizzle-orm/src/singlestore/driver.ts | 2 +- drizzle-orm/src/singlestore/session.ts | 1 + 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drizzle-orm/src/monodriver.ts b/drizzle-orm/src/monodriver.ts index ca64a3173..612da1bdc 100644 --- a/drizzle-orm/src/monodriver.ts +++ b/drizzle-orm/src/monodriver.ts @@ -220,9 +220,8 @@ export async function drizzle< : TClient extends 'neon-serverless' ? DrizzleConfig & { ws?: any; } - : - TClient extends 'singlestore' ? SingleStoreDriverDrizzleConfig : - DrizzleConfig), + : TClient extends 'singlestore' ? SingleStoreDriverDrizzleConfig + : DrizzleConfig), ): Promise> { const { connection, ws, ...drizzleConfig } = params as typeof params & { ws?: any; diff --git a/drizzle-orm/src/monomigrator.ts b/drizzle-orm/src/monomigrator.ts index d8681ebf9..73b4e07e6 100644 --- a/drizzle-orm/src/monomigrator.ts +++ b/drizzle-orm/src/monomigrator.ts @@ -12,7 +12,7 @@ import type { NeonDatabase } from './neon-serverless/index.ts'; import type { NodePgDatabase } from './node-postgres/index.ts'; import type { PlanetScaleDatabase } from './planetscale-serverless/index.ts'; import type { PostgresJsDatabase } from './postgres-js/index.ts'; -import type { SingleStore2Database } from './singlestore/driver.ts'; +import type { SingleStoreDriverDatabase } from './singlestore/driver.ts'; import type { TiDBServerlessDatabase } from './tidb-serverless/index.ts'; import type { VercelPgDatabase } from './vercel-postgres/index.ts'; @@ -31,7 +31,7 @@ export async function migrate( | PostgresJsDatabase | VercelPgDatabase | TiDBServerlessDatabase - | SingleStore2Database, + | SingleStoreDriverDatabase, config: | string | MigrationConfig, @@ -105,7 +105,7 @@ export async function migrate( case 'SingleStore2Database': { const { migrate } = await import('./singlestore/migrator'); - return migrate(db as SingleStore2Database, config as MigrationConfig); + return migrate(db as SingleStoreDriverDatabase, config as MigrationConfig); } } } diff --git a/drizzle-orm/src/singlestore/driver.ts b/drizzle-orm/src/singlestore/driver.ts index cc390ee9c..ffc5c2795 100644 --- a/drizzle-orm/src/singlestore/driver.ts +++ b/drizzle-orm/src/singlestore/driver.ts @@ -12,6 +12,7 @@ import { SingleStoreDatabase } from '~/singlestore-core/db.ts'; import { SingleStoreDialect } from '~/singlestore-core/dialect.ts'; import type { DrizzleConfig } from '~/utils.ts'; import type { + Mode, SingleStoreDriverClient, SingleStoreDriverPreparedQueryHKT, SingleStoreDriverQueryResultHKT, @@ -45,7 +46,6 @@ export type SingleStoreDriverDatabase< TSchema extends Record = Record, > = SingleStoreDatabase; - export type SingleStoreDriverDrizzleConfig = Record> = & Omit, 'schema'> & ({ schema: TSchema; mode: Mode } | { schema?: undefined; mode?: Mode }); diff --git a/drizzle-orm/src/singlestore/session.ts b/drizzle-orm/src/singlestore/session.ts index 8bde88740..0ea143971 100644 --- a/drizzle-orm/src/singlestore/session.ts +++ b/drizzle-orm/src/singlestore/session.ts @@ -31,6 +31,7 @@ import { fillPlaceholders, sql } from '~/sql/sql.ts'; import type { Query, SQL } from '~/sql/sql.ts'; import { type Assume, mapResultRow } from '~/utils.ts'; +// must keep this type here for compatibility with DrizzleConfig export type Mode = 'default'; export type SingleStoreDriverClient = Pool | Connection;