From 93450410dac36b0d805bfb446133d1b1881d167b Mon Sep 17 00:00:00 2001 From: Nana-EC <56320167+Nana-EC@users.noreply.github.com> Date: Mon, 4 Jan 2021 16:44:50 -0600 Subject: [PATCH] Improved sed process Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com> --- docker-compose.yml | 2 +- .../main/resources/db/scripts/timescaledb/migration.config | 2 ++ .../src/main/resources/db/scripts/timescaledb/migration.sh | 5 +---- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7883b98e4e9..d730b78db2d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -79,7 +79,7 @@ services: environment: POSTGRES_PASSWORD: mirror_node_pass volumes: - - ./tsdb:/var/lib/postgresql/data + - ./timescaledb:/var/lib/postgresql/data - ./hedera-mirror-importer/src/main/resources/db/scripts/init_v2.sql/:/docker-entrypoint-initdb.d/init_v2.sql ports: - 5432:5432 diff --git a/hedera-mirror-importer/src/main/resources/db/scripts/timescaledb/migration.config b/hedera-mirror-importer/src/main/resources/db/scripts/timescaledb/migration.config index 61e459c6228..70f0d71dbf8 100644 --- a/hedera-mirror-importer/src/main/resources/db/scripts/timescaledb/migration.config +++ b/hedera-mirror-importer/src/main/resources/db/scripts/timescaledb/migration.config @@ -8,3 +8,5 @@ NEW_DB_NAME=mirror_node NEW_DB_PORT=6432 NEW_DB_USER=mirror_node NEW_PASSWORD=mirror_node_pass +CHUNK_INTERVAL_TIME=604800000000000 +CHUNK_INTERVAL_ID=10000 diff --git a/hedera-mirror-importer/src/main/resources/db/scripts/timescaledb/migration.sh b/hedera-mirror-importer/src/main/resources/db/scripts/timescaledb/migration.sh index f46ab6eac78..80606144d36 100755 --- a/hedera-mirror-importer/src/main/resources/db/scripts/timescaledb/migration.sh +++ b/hedera-mirror-importer/src/main/resources/db/scripts/timescaledb/migration.sh @@ -78,11 +78,8 @@ echo "3. Create v2 table schemas in TimescaleDB($NEW_DB_HOST:$NEW_DB_PORT)..." PGPASSWORD=${NEW_PASSWORD} psql -h $NEW_DB_HOST -d $NEW_DB_NAME -p $NEW_DB_PORT -U $NEW_DB_USER scripts/timescaledb/createHyperTables_0.sql -sed 's/${chunkIdInterval}/'$CHUNK_INTERVAL_ID'/g' scripts/timescaledb/createHyperTables_0.sql >scripts/timescaledb/createHyperTables.sql +sed -e 's/${chunkTimeInterval}/'$CHUNK_INTERVAL_TIME'/g' -e 's/${chunkIdInterval}/'$CHUNK_INTERVAL_ID'/g' migration/v2/V2.0.1__hyper_tables.sql >scripts/timescaledb/createHyperTables.sql PGPASSWORD=${NEW_PASSWORD} psql -h $NEW_DB_HOST -d $NEW_DB_NAME -p $NEW_DB_PORT -U $NEW_DB_USER -f scripts/timescaledb/createHyperTables.sql -rm scripts/timescaledb/createHyperTables_0.sql -rm scripts/timescaledb/createHyperTables.sql echo "5. Backing up tables from from Postgres($OLD_DB_HOST:$OLD_DB_PORT) to separate CSV's..." PGPASSWORD=${OLD_PASSWORD} psql -h $OLD_DB_HOST -d $OLD_DB_NAME -p $OLD_DB_PORT -U $OLD_DB_USER -f scripts/timescaledb/csvBackupTables.sql