Open rphlmr opened 2 months ago
TLDR: The check command currently ignores the selected dialect and instead runs for all dialects. Local solve is to comment out the dialects you're not using in the bin.cjs
file, see codesnippet below.
This issue has been reported on the drizzle-orm repo aswell under drizzle-orm#2284. I looked thru the compiled cli code for drizzle-kit and found that the check command currently ignores the dialect you have chosen. I've attached the problematic code and also the code for the up command which does the dialect check correctly.
Seems like just a dev test that was forgotten or that in the past the checkHandlers themselves quit if it wasn't the correct dialect. Should be a rather simple fix just copying what's being done in the up command.
Code snipped from
bin.cjs
line 113657 - 113682 in drizzle-kit@0.21.2.var checkCommand = new import_commander.Command("check").option("--config <config>", `Drizzle config file path`).option("--dialect <dialect>", "Database dialect").option("--out <out>", `Output folder`).action(async (options) => { await printVersions(); await assertOrmCoreVersion(); const params = cliConfigCheck.parse(options); const { out, dialect: dialect7 } = await assertOutFolder(params); checkHandler(out, "postgresql"); checkHandler(out, "sqlite"); checkHandler(out, "mysql"); console.log("Everything's fine \u{1F436}\u{1F525}"); }); var upCommand = new import_commander.Command("up").option("--config <config>", `Drizzle config file path`).option("--dialect <dialect>", "Database dialect").option("--out <out>", `Output folder`).action(async (options) => { await printVersions(); await assertOrmCoreVersion(); const params = cliConfigCheck.parse(options); const { out, dialect: dialect7 } = await assertOutFolder(params); await assertPackages("drizzle-orm"); if (dialect7 === "postgresql") { upPgHandler(out); } if (dialect7 === "mysql") { upMysqlHandler(out); } if (dialect7 === "sqlite") { upSqliteHandler(out); } });
drizzle-kit check
throws a zod validation error.