add postgres support

This commit is contained in:
Aman Varshney
2025-03-17 16:36:41 +05:30
parent 30e16b5d09
commit 98b1262b41
21 changed files with 261 additions and 29 deletions

View File

@@ -27,9 +27,7 @@ export async function createProject(options: ProjectConfig): Promise<string> {
if (options.orm !== "none" && options.database !== "none") {
const ormTemplateDir = path.join(
PKG_ROOT,
options.orm === "drizzle"
? "template/with-drizzle"
: "template/with-prisma",
getOrmTemplateDir(options.orm, options.database),
);
if (await fs.pathExists(ormTemplateDir)) {
@@ -143,3 +141,19 @@ export async function createProject(options: ProjectConfig): Promise<string> {
throw error;
}
}
function getOrmTemplateDir(orm: string, database: string): string {
if (orm === "drizzle") {
return database === "sqlite"
? "template/with-drizzle-sqlite"
: "template/with-drizzle-postgres";
}
if (orm === "prisma") {
return database === "sqlite"
? "template/with-prisma-sqlite"
: "template/with-prisma-postgres";
}
return "template/base";
}