Skip to content

Commit

Permalink
fix(create-medusa-app): fix database name from input not used in setup (
Browse files Browse the repository at this point in the history
  • Loading branch information
shahednasser authored and noubase committed Jan 22, 2025
1 parent cf765b2 commit c1133ac
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/light-fireants-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-medusa-app": patch
---

fix(create-medusa-app): fix database name from input not used in setup
1 change: 1 addition & 0 deletions packages/cli/create-medusa-app/src/utils/create-db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ export async function getDbClientAndCredentials({
client: pg.Client
dbConnectionString: string
verbose?: boolean
dbName?: string
}> {
if (dbName) {
return await getForDbName({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class MedusaProjectCreator
}

private async setupDatabase(): Promise<void> {
const dbName = `medusa-${slugify(this.projectName)}`
let dbName = `medusa-${slugify(this.projectName)}`
const { client, dbConnectionString, ...rest } =
await getDbClientAndCredentials({
dbName,
Expand All @@ -115,11 +115,12 @@ export class MedusaProjectCreator
this.client = client
this.dbConnectionString = dbConnectionString
this.isDbInitialized = true
dbName = rest.dbName || dbName

if (!this.options.dbUrl) {
this.factBoxOptions.interval = displayFactBox({
...this.factBoxOptions,
title: "Creating database...",
message: "Creating database...",
})

this.client = await runCreateDb({
Expand Down

0 comments on commit c1133ac

Please sign in to comment.