From c7815088622d39b8792c072366c72836fce3a932 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 27 Aug 2019 01:55:59 -0400 Subject: make load script handle the whole database --- bin/load | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'bin') diff --git a/bin/load b/bin/load index 1f9fa72..6fa7777 100755 --- a/bin/load +++ b/bin/load @@ -1,14 +1,24 @@ #!/bin/sh set -eu -cd "$(dirname "$0")/.." || exit 1 +/home/doy/.cargo/bin/ynab-export +/home/doy/.cargo/bin/ynab-export schema | psql -U metabase money -cargo build -cd data || exit 1 +seq 1000000 | psql -U metabase money -c 'COPY ints FROM STDIN' -rm -f ./*.tsv || true -../target/debug/investments-sheet-export "$@" +psql -U metabase money -c 'COPY accounts FROM STDIN' < accounts.tsv +psql -U metabase money -c 'COPY category_groups FROM STDIN' < category_groups.tsv +psql -U metabase money -c 'COPY categories FROM STDIN' < categories.tsv +psql -U metabase money -c 'COPY months FROM STDIN' < months.tsv +psql -U metabase money -c 'COPY categories_by_month FROM STDIN' < categories_by_month.tsv +psql -U metabase money -c 'COPY payees FROM STDIN' < payees.tsv +psql -U metabase money -c 'COPY transactions FROM STDIN' < transactions.tsv +psql -U metabase money -c 'COPY subtransactions FROM STDIN' < subtransactions.tsv +psql -U metabase money -c 'COPY scheduled_transactions FROM STDIN' < scheduled_transactions.tsv +psql -U metabase money -c 'COPY scheduled_subtransactions FROM STDIN' < scheduled_subtransactions.tsv -psql -U metabase investments < schema.sql -psql -U metabase investments -c 'COPY categories FROM STDIN' < categories.tsv -psql -U metabase investments -c 'COPY holdings FROM STDIN' < holdings.tsv +cargo run --manifest-path "$(dirname "$0")/../Cargo.toml" --bin investments-sheet-export "$@" +psql -U metabase money < "$(dirname "$0")/../data/investments-sheet-schema.sql" + +psql -U metabase money -c 'COPY investment_categories FROM STDIN' < investment_categories.tsv +psql -U metabase money -c 'COPY holdings FROM STDIN' < holdings.tsv -- cgit v1.2.3-54-g00ecf