Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/singlestore integration tests #12

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions drizzle-kit/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { randomUUID } from 'crypto';
import { LibSQLDatabase } from 'drizzle-orm/libsql';
import type { MySql2Database } from 'drizzle-orm/mysql2';
import { PgDatabase } from 'drizzle-orm/pg-core';
import { SingleStore2Database } from 'drizzle-orm/singlestore';
import { SingleStoreDriverDatabase } from 'drizzle-orm/singlestore';
import {
columnsResolver,
enumsResolver,
Expand Down Expand Up @@ -394,7 +394,7 @@ export const generateSingleStoreMigration = async (

export const pushSingleStoreSchema = async (
imports: Record<string, unknown>,
drizzleInstance: SingleStore2Database<any>,
drizzleInstance: SingleStoreDriverDatabase<any>,
databaseName: string,
) => {
const { applySingleStoreSnapshotsDiff } = await import('./snapshotsDiffer');
Expand Down
9 changes: 5 additions & 4 deletions drizzle-orm/src/monodriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,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, SingleStore2DrizzleConfig } from './singlestore/driver.ts';
import type { SingleStoreDriverDatabase, SingleStoreDriverDrizzleConfig } from './singlestore/driver.ts';
import type { TiDBServerlessDatabase } from './tidb-serverless/index.ts';
import type { DrizzleConfig } from './utils.ts';
import type { VercelPgDatabase } from './vercel-postgres/index.ts';
Expand Down Expand Up @@ -116,7 +116,7 @@ type ClientDrizzleInstanceMap<TSchema extends Record<string, any>> = {
d1: DrizzleD1Database<TSchema>;
'bun:sqlite': BunSQLiteDatabase<TSchema>;
'better-sqlite3': DrizzleBetterSQLite3Database<TSchema>;
singlestore: SingleStore2Database<TSchema>;
singlestore: SingleStoreDriverDatabase<TSchema>;
};

type ClientInstanceMap = {
Expand All @@ -138,7 +138,7 @@ type ClientInstanceMap = {
d1: D1Database;
'bun:sqlite': BunDatabase;
'better-sqlite3': BetterSQLite3Database;
singlestore: SingleStore2Database;
singlestore: SingleStoreDriverDatabase;
};

type InitializerParams = {
Expand Down Expand Up @@ -220,6 +220,7 @@ export async function drizzle<
: TClient extends 'neon-serverless' ? DrizzleConfig<TSchema> & {
ws?: any;
}
: TClient extends 'singlestore' ? SingleStoreDriverDrizzleConfig<TSchema>
: DrizzleConfig<TSchema>),
): Promise<DetermineClient<TClient, TSchema>> {
const { connection, ws, ...drizzleConfig } = params as typeof params & {
Expand Down Expand Up @@ -394,7 +395,7 @@ export async function drizzle<
const instance = createPool(connection as Mysql2Config);
const { drizzle } = await import('./mysql2');

const db = drizzle(instance, drizzleConfig as SingleStore2DrizzleConfig) as any;
const db = drizzle(instance, drizzleConfig as SingleStoreDriverDrizzleConfig) as any;
db.$client = instance;

return db;
Expand Down
8 changes: 4 additions & 4 deletions drizzle-orm/src/monomigrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -31,7 +31,7 @@ export async function migrate(
| PostgresJsDatabase<any>
| VercelPgDatabase<any>
| TiDBServerlessDatabase<any>
| SingleStore2Database<any>,
| SingleStoreDriverDatabase<any>,
config:
| string
| MigrationConfig,
Expand Down Expand Up @@ -102,10 +102,10 @@ export async function migrate(

return migrate(db as VercelPgDatabase, config as string | MigrationConfig);
}
case 'SingleStore2Database': {
case 'SingleStoreDriverDatabase': {
const { migrate } = await import('./singlestore/migrator');

return migrate(db as SingleStore2Database, config as MigrationConfig);
return migrate(db as SingleStoreDriverDatabase, config as MigrationConfig);
}
}
}
3 changes: 0 additions & 3 deletions drizzle-orm/src/singlestore-core/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import type { OptimizeTableArgument } from './query-builders/optimizeTable.types
import { RelationalQueryBuilder } from './query-builders/query.ts';
import type { SelectedFields } from './query-builders/select.types.ts';
import type {
Mode,
PreparedQueryHKTBase,
SingleStoreQueryResultHKT,
SingleStoreQueryResultKind,
Expand Down Expand Up @@ -61,7 +60,6 @@ export class SingleStoreDatabase<
/** @internal */
readonly session: SingleStoreSession<any, any, any, any>,
schema: RelationalSchemaConfig<TSchema> | undefined,
protected readonly mode: Mode,
) {
this._ = schema
? {
Expand All @@ -86,7 +84,6 @@ export class SingleStoreDatabase<
columns,
dialect,
session,
this.mode,
);
}
}
Expand Down
Loading
Loading