mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-16 19:00:38 +09:00
Fix workspace review issues and policy check
This commit is contained in:
parent
6e6d67372c
commit
dd828e96ad
6 changed files with 123 additions and 407 deletions
|
|
@ -66,13 +66,17 @@ async function ensureEmbeddedPostgresConnection(
|
|||
): Promise<MigrationConnection> {
|
||||
const EmbeddedPostgres = await loadEmbeddedPostgresCtor();
|
||||
const postmasterPidFile = path.resolve(dataDir, "postmaster.pid");
|
||||
const pgVersionFile = path.resolve(dataDir, "PG_VERSION");
|
||||
const runningPid = readRunningPostmasterPid(postmasterPidFile);
|
||||
const runningPort = readPidFilePort(postmasterPidFile);
|
||||
const preferredAdminConnectionString = `postgres://paperclip:paperclip@127.0.0.1:${preferredPort}/postgres`;
|
||||
|
||||
if (!runningPid) {
|
||||
if (!runningPid && existsSync(pgVersionFile)) {
|
||||
try {
|
||||
await ensurePostgresDatabase(preferredAdminConnectionString, "paperclip");
|
||||
process.emitWarning(
|
||||
`Adopting an existing PostgreSQL instance on port ${preferredPort} for embedded data dir ${dataDir} because postmaster.pid is missing.`,
|
||||
);
|
||||
return {
|
||||
connectionString: `postgres://paperclip:paperclip@127.0.0.1:${preferredPort}/paperclip`,
|
||||
source: `embedded-postgres@${preferredPort}`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue