Repository: drizzle-team/drizzle-orm
File: drizzle-orm/src/planetscale-serverless/driver.ts (TypeScript)

Code before:
import {
	createTableRelationsHelpers,
	extractTablesRelationalConfig,
	type RelationalSchemaConfig,
	type TablesRelationalConfig,
} from '~/relations.ts';
import type { DrizzleConfig } from '~/utils.ts';
import { DrizzleError } from '../index.ts';
import type { PlanetScalePreparedQueryHKT, PlanetscaleQueryResultHKT } from './session.ts';
import { PlanetscaleSession } from './session.ts';

export interface PlanetscaleSDriverOptions {
	logger?: Logger;
}

export type PlanetScaleDatabase<
	TSchema extends Record<string, unknown> = Record<string, never>,
> = MySqlDatabase<PlanetscaleQueryResultHKT, PlanetScalePreparedQueryHKT, TSchema>;

export function drizzle<TSchema extends Record<string, unknown> = Record<string, never>>(
	client: Client,
	config: DrizzleConfig<TSchema> = {},
): PlanetScaleDatabase<TSchema> {
	if (!(client instanceof Client)) {
		throw new DrizzleError({
			message: `You need to pass an instance of Client:

import { Client } from "@planetscale/database";

const client = new Client({
  host: process.env["DATABASE_HOST"],
  username: process.env["DATABASE_USERNAME"],
  password: process.env["DATABASE_PASSWORD"],
});

const db = drizzle(client);
`,
		});
	}

	const dialect = new MySqlDialect();
	let logger;
	if (config.logger === true) {
		logger = new DefaultLogger();
	} else if (config.logger !== false) {
		logger = config.logger;
	}

	let schema: RelationalSchemaConfig<TablesRelationalConfig> | undefined;
	if (config.schema) {
		const tablesConfig = extractTablesRelationalConfig(

Review comment (suggestion):
Please use `is()` from `drizzle-orm` package

https://orm.drizzle.team/docs/goodies#compare-objects-types-instanceof-alternative

```ts
if (!is(client, Client)) {
...
```

Code after:
import { MySqlDialect } from '~/mysql-core/dialect.ts';
import {
	createTableRelationsHelpers,
	extractTablesRelationalConfig,
	type RelationalSchemaConfig,
	type TablesRelationalConfig,
} from '~/relations.ts';
import type { DrizzleConfig } from '~/utils.ts';
import type { PlanetScalePreparedQueryHKT, PlanetscaleQueryResultHKT } from './session.ts';
import { PlanetscaleSession } from './session.ts';

export interface PlanetscaleSDriverOptions {
	logger?: Logger;
}

export type PlanetScaleDatabase<
	TSchema extends Record<string, unknown> = Record<string, never>,
> = MySqlDatabase<PlanetscaleQueryResultHKT, PlanetScalePreparedQueryHKT, TSchema>;

export function drizzle<TSchema extends Record<string, unknown> = Record<string, never>>(
	client: Client | Connection,
	config: DrizzleConfig<TSchema> = {},
): PlanetScaleDatabase<TSchema> {
	// Client is not Drizzle Object, so we can ignore this rule here
	// eslint-disable-next-line no-instanceof/no-instanceof
	if (!(client instanceof Client)) {
		// Should use error on 0.30.0 release
		// 		throw new DrizzleError({
		// 			message: `You need to pass an instance of Client:

		// import { Client } from "@planetscale/database";

		// const client = new Client({
		//   host: process.env["DATABASE_HOST"],
		//   username: process.env["DATABASE_USERNAME"],
		//   password: process.env["DATABASE_PASSWORD"],
		// });

		// const db = drizzle(client);
		// `,
		// 		});
		console.log(`Warning: You need to pass an instance of Client:

import { Client } from "@planetscale/database";

const client = new Client({
  host: process.env["DATABASE_HOST"],
  username: process.env["DATABASE_USERNAME"],
  password: process.env["DATABASE_PASSWORD"],
});