kempo 4.2.12 → 4.2.14
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.
- package/bin/cli.js +8 -5
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -62,11 +62,11 @@ const getPostgresContainers = () => {
|
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
const waitForPostgres = async (containerName) => {
|
|
65
|
+
const waitForPostgres = async (containerName, dbName = 'postgres') => {
|
|
66
66
|
process.stdout.write('Waiting for Postgres to be ready');
|
|
67
67
|
for(let i = 0; i < 30; i++){
|
|
68
68
|
try {
|
|
69
|
-
execSync(`docker exec ${containerName} pg_isready -U kempo -d
|
|
69
|
+
execSync(`docker exec ${containerName} pg_isready -U kempo -d ${dbName}`, { stdio: 'ignore' });
|
|
70
70
|
process.stdout.write(' ready!\n');
|
|
71
71
|
return;
|
|
72
72
|
} catch {
|
|
@@ -373,7 +373,7 @@ volumes:
|
|
|
373
373
|
);
|
|
374
374
|
console.log('Created docker-compose.yml');
|
|
375
375
|
}
|
|
376
|
-
|
|
376
|
+
}
|
|
377
377
|
|
|
378
378
|
writeFileSync(join(projectDir, '.env'),
|
|
379
379
|
`# Database
|
|
@@ -414,12 +414,12 @@ if(containerMode === 'new'){
|
|
|
414
414
|
printManualSteps(databaseUrl);
|
|
415
415
|
process.exit(1);
|
|
416
416
|
}
|
|
417
|
-
await waitForPostgres(containerName);
|
|
417
|
+
await waitForPostgres(containerName, 'postgres');
|
|
418
418
|
} else {
|
|
419
419
|
const container = existingContainers.find(c => c.name === containerName);
|
|
420
420
|
if(container && !container.running){
|
|
421
421
|
execSync(`docker start ${containerName}`, { stdio: 'inherit' });
|
|
422
|
-
await waitForPostgres(containerName);
|
|
422
|
+
await waitForPostgres(containerName, 'postgres');
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
425
|
|
|
@@ -429,6 +429,9 @@ if(containerMode === 'new'){
|
|
|
429
429
|
|
|
430
430
|
console.log('\n--- Initializing database ---\n');
|
|
431
431
|
|
|
432
|
+
// Give database a moment to initialize
|
|
433
|
+
await new Promise(r => setTimeout(r, 2000));
|
|
434
|
+
|
|
432
435
|
// Clear migration snapshots so drizzle-kit push compares against the live DB only
|
|
433
436
|
const migrationDir = join(projectDir, 'server', 'db', 'migrations');
|
|
434
437
|
if(existsSync(migrationDir)){
|