vasuzex 2.3.1 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -144,8 +144,11 @@ export async function createDatabase() {
|
|
|
144
144
|
console.log(`📦 Creating database: ${dbName}...`);
|
|
145
145
|
|
|
146
146
|
// Try to create database using psql
|
|
147
|
+
// CRITICAL FIX: Connect to 'postgres' database (not default user database) when checking/creating target database
|
|
148
|
+
// Without -d postgres, psql tries to connect to database matching username (e.g., "neasto_user" database)
|
|
149
|
+
// This causes "FATAL: database 'neasto_user' does not exist" when POSTGRES_USER=neasto_user
|
|
147
150
|
execSync(
|
|
148
|
-
`PGPASSWORD="${process.env.POSTGRES_PASSWORD}" psql -h ${dbHost} -p ${dbPort} -U ${dbUser} -tc "SELECT 1 FROM pg_database WHERE datname = '${dbName}'" | grep -q 1 || PGPASSWORD="${process.env.POSTGRES_PASSWORD}" psql -h ${dbHost} -p ${dbPort} -U ${dbUser} -c "CREATE DATABASE ${dbName}"`,
|
|
151
|
+
`PGPASSWORD="${process.env.POSTGRES_PASSWORD}" psql -h ${dbHost} -p ${dbPort} -U ${dbUser} -d postgres -tc "SELECT 1 FROM pg_database WHERE datname = '${dbName}'" | grep -q 1 || PGPASSWORD="${process.env.POSTGRES_PASSWORD}" psql -h ${dbHost} -p ${dbPort} -U ${dbUser} -d postgres -c "CREATE DATABASE ${dbName}"`,
|
|
149
152
|
{ stdio: 'inherit' }
|
|
150
153
|
);
|
|
151
154
|
|