fix(create-medusa-app): fix database name from input not used in setup (#11071)

This commit is contained in:
Shahed Nasser authored and GitHub committed 2025-01-21 12:35:46 +02:00
1 parent 13fe2f6776
commit cd758067d4
3 files changed
+9 -2

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"create-medusa-app": patch
---
fix(create-medusa-app): fix database name from input not used in setup
@@ -224,6 +224,7 @@ export async function getDbClientAndCredentials({
client: pg.Client client: pg.Client
dbConnectionString: string dbConnectionString: string
verbose?: boolean verbose?: boolean
dbName?: string
}> { }> {
if (dbName) { if (dbName) {
return await getForDbName({ return await getForDbName({
@@ -104,7 +104,7 @@ export class MedusaProjectCreator
} }
private async setupDatabase(): Promise<void> { private async setupDatabase(): Promise<void> {
const dbName = `medusa-${slugify(this.projectName)}` let dbName = `medusa-${slugify(this.projectName)}`
const { client, dbConnectionString, ...rest } = const { client, dbConnectionString, ...rest } =
await getDbClientAndCredentials({ await getDbClientAndCredentials({
dbName, dbName,
@@ -115,11 +115,12 @@ export class MedusaProjectCreator
this.client = client this.client = client
this.dbConnectionString = dbConnectionString this.dbConnectionString = dbConnectionString
this.isDbInitialized = true this.isDbInitialized = true
dbName = rest.dbName || dbName
if (!this.options.dbUrl) { if (!this.options.dbUrl) {
this.factBoxOptions.interval = displayFactBox({ this.factBoxOptions.interval = displayFactBox({
...this.factBoxOptions, ...this.factBoxOptions,
title: "Creating database...", message: "Creating database...",
}) })
this.client = await runCreateDb({ this.client = await runCreateDb({