feat(create-medusa-app): prompt for database name with credentials (#8552)
* feat(create-medusa-app): prompt for database name with credentials * refactor
This commit is contained in:
@@ -105,10 +105,23 @@ async function getForDbName({
|
|||||||
postgresUsername = answers.postgresUsername
|
postgresUsername = answers.postgresUsername
|
||||||
postgresPassword = answers.postgresPassword
|
postgresPassword = answers.postgresPassword
|
||||||
|
|
||||||
|
const { userDbName } = await inquirer.prompt([
|
||||||
|
{
|
||||||
|
type: "database",
|
||||||
|
name: "userDbName",
|
||||||
|
message: "Enter your Postgres user's database name",
|
||||||
|
default: answers.postgresUsername,
|
||||||
|
validate: (input) => {
|
||||||
|
return typeof input === "string" && input.length > 0
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
try {
|
try {
|
||||||
client = await postgresClient({
|
client = await postgresClient({
|
||||||
user: postgresUsername,
|
user: postgresUsername,
|
||||||
password: postgresPassword,
|
password: postgresPassword,
|
||||||
|
database: userDbName,
|
||||||
...defaultConnectionOptions
|
...defaultConnectionOptions
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -173,9 +173,7 @@ export default async ({
|
|||||||
...factBoxOptions,
|
...factBoxOptions,
|
||||||
message: "Ran Migrations",
|
message: "Ran Migrations",
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
if (!skipDb && migrations) {
|
|
||||||
// create admin user
|
// create admin user
|
||||||
factBoxOptions.interval = displayFactBox({
|
factBoxOptions.interval = displayFactBox({
|
||||||
...factBoxOptions,
|
...factBoxOptions,
|
||||||
@@ -204,9 +202,7 @@ export default async ({
|
|||||||
...factBoxOptions,
|
...factBoxOptions,
|
||||||
message: "Created admin user",
|
message: "Created admin user",
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
if (!skipDb && migrations) {
|
|
||||||
// TODO for now we just seed the default data
|
// TODO for now we just seed the default data
|
||||||
// we should add onboarding seeding again if it makes
|
// we should add onboarding seeding again if it makes
|
||||||
// since once we re-introduce the onboarding flow.
|
// since once we re-introduce the onboarding flow.
|
||||||
|
|||||||
Reference in New Issue
Block a user