From 8b9b76b1a6e104888deea2d6f500721e13b90764 Mon Sep 17 00:00:00 2001 From: August Kilponen Date: Thu, 19 Dec 2024 22:40:14 +0200 Subject: [PATCH] =?UTF-8?q?Lis=C3=A4tty=20content-type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lampi-siirtaja-container/lampi-siirtaja/src/run.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lampi-siirtaja-container/lampi-siirtaja/src/run.ts b/lampi-siirtaja-container/lampi-siirtaja/src/run.ts index 906c90c..a1971dc 100644 --- a/lampi-siirtaja-container/lampi-siirtaja/src/run.ts +++ b/lampi-siirtaja-container/lampi-siirtaja/src/run.ts @@ -80,7 +80,8 @@ const copyFileToLampi = async (sourceKey: string): Promise => { Bucket: lampiS3Bucket, Key: destinationKey, Body: getObjectCommandOutput.Body, - ContentLength: getObjectCommandOutput.ContentLength + ContentLength: getObjectCommandOutput.ContentLength, + ContentType: 'text/csv' }) ); @@ -105,18 +106,24 @@ const uploadManifestToLampi = async (manifest: ManifestItem[]) => { const main = async () => { validateParameters(); + console.log(`Aloitetaan Ovaran tietojen kopiointi Lampeen`); console.log(`Tietokannan konfiguraatio: ${dbUri}`.replace(dbPassword, '*****')); + const schemaNames = ['pub', 'stg']; const manifest: ManifestItem[] = []; + for (const schemaName of schemaNames) { + console.log(`Aloitetaan scheman "${schemaName}" taulujen siirtäminen Lampeen`); const tableNames: string[] = getTableNames(schemaName); console.log(`Table names: ${tableNames}`); + for (const tableName of tableNames) { console.log(`Aloitetaan scheman "${schemaName}" taulun "${tableName}" siirtäminen tietokannasta Ovaran S3-ämpäriin`); copyTableToS3(schemaName, tableName); console.log(`Scheman "${schemaName}" taulun "${tableName}" siirtäminen tietokannasta Ovaran S3-ämpäriin valmistui`); + const sourceKey = `${schemaName}.${tableName}.csv`; console.log(`Aloitetaan scheman "${schemaName}" taulun "${tableName}" siirtäminen Ovaran S3-ämpäristä Lammen S3-ämpäriin (key: "${sourceKey}")`); const manifestItem = await copyFileToLampi(sourceKey);