(command: ChildProcess.StandardCommand)
| 58 | |
| 59 | // Parses the libpq conninfo passed as `pg_dump --dbname=<conninfo>`. |
| 60 | const dumpConnection = (command: ChildProcess.StandardCommand) => { |
| 61 | const dbname = command.args.find((arg): arg is string => typeof arg === "string" && arg.startsWith("--dbname=")) |
| 62 | assert(dbname !== undefined, "pg_dump was not given --dbname") |
| 63 | const conninfo: Record<string, string> = {} |
| 64 | for (const [, key, quoted, plain] of dbname.slice(9).matchAll(/(\w+)\s*=\s*(?:'((?:[^'\\]|\\.)*)'|(\S*))/g)) { |
| 65 | conninfo[key] = quoted !== undefined ? quoted.replace(/\\(.)/g, "$1") : plain |
| 66 | } |
| 67 | return conninfo |
| 68 | } |
| 69 | |
| 70 | describe("PgMigrator", () => { |
| 71 | it.effect("shares one password per schema dump and refreshes it for the next dump", () => |
no test coverage detected