import from postgres dump

This commit is contained in:
Jan Prochazka
2024-09-27 08:08:13 +02:00
parent ae599ac6f6
commit 5287a86397
13 changed files with 25 additions and 17 deletions

View File

@@ -19,10 +19,14 @@ class ImportStream extends stream.Transform {
try {
if (chunk.specialMarker == 'copy_stdin_start') {
this.writeQueryStream = await this.driver.writeQueryFromStream(this.dbhan, chunk.text);
} else if (chunk.specialMarker == 'copy_stdin_data') {
} else if (chunk.specialMarker == 'copy_stdin_line') {
this.writeQueryStream.write(chunk.text);
} else if (chunk.specialMarker == 'copy_stdin_end') {
this.writeQueryStream.end();
await new Promise((resolve, reject) => {
this.writeQueryStream.on('finish', resolve);
this.writeQueryStream.on('error', reject);
});
this.writeQueryStream = null;
} else {
await this.driver.script(this.dbhan, chunk.text, { queryOptions: { importSqlDump: true } });