drizzle-team / drizzle-kit-mirror

Docs and issues repository for drizzle-kit
290 stars 17 forks source link

Config type for mysql #97

Closed jeremiedubuis closed 1 year ago

jeremiedubuis commented 1 year ago

Hi, first of all thanks for the great work on drizzle-orm and drizzle-kit. I think I have spotted an error int he Config type exported for drizzle-kit.

Using a drizzle.config.ts file on mysql21 project and seeing the following type:

export type Config = {
    out?: string | undefined;
    breakpoints?: boolean | undefined;
    tablesFilter?: string | string[] | undefined;
    schema?: string | string[];
    verbose?: boolean | undefined;
    strict?: boolean | undefined;
} & {
    introspect?: {
        casing: "camel" | "preserve";
    };
} & ({
    driver: "turso";
    dbCredentials: {
        url: string;
        authToken?: string;
    };
} | {
    driver: "better-sqlite";
    dbCredentials: {
        url: string;
    };
} | {
    driver: "libsql";
    dbCredentials: {
        url: string;
    };
} | {
    driver: "pg";
    dbCredentials: {
        host: string;
        port?: number;
        user?: string;
        password?: string;
        database: string;
        ssl?: boolean;
    };
} | {
    driver: "pg";
    dbCredentials: {
        connectionString: string;
    };
} | {
    driver: "mysql2";
    dbCredentials: {
        host: string;
        port?: number;
        user?: string;
        password?: string;
        database: string;
        connectionString: string;
    };
} | {
    driver: "mysql2";
    dbCredentials: {
        connectionString: string;
    };
} | {});

For the mysql2 driver:

{
    driver: "mysql2";
    dbCredentials: {
        host: string;
        port?: number;
        user?: string;
        password?: string;
        database: string;
        connectionString: string;
    };
} | {
    driver: "mysql2";
    dbCredentials: {
        connectionString: string;
    };
}

It seems to me the connectionString should not be present for the first type.

AndriiSherman commented 1 year ago

fixed in drizzle-kit@cjs, will be in latest today

AndriiSherman commented 1 year ago

Fixed in drizzle-kit@0.19.2