aboutsummaryrefslogtreecommitdiffstats
path: root/bin/load
blob: 0df1d32c98ee85791590c00070f1760f16d2c3af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
set -eu

cd "$(dirname "$0")/.." || exit 1

cargo build
cd data || exit 1

rm -f ./*.tsv || true
../target/debug/ynab-export

psql -U metabase ynab < schema.sql
psql -U metabase ynab -c 'COPY accounts FROM STDIN' < accounts.tsv
psql -U metabase ynab -c 'COPY category_groups FROM STDIN' < category_groups.tsv
psql -U metabase ynab -c 'COPY categories FROM STDIN' < categories.tsv
psql -U metabase ynab -c 'COPY months FROM STDIN' < months.tsv
psql -U metabase ynab -c 'COPY categories_by_month FROM STDIN' < categories_by_month.tsv
psql -U metabase ynab -c 'COPY payees FROM STDIN' < payees.tsv
psql -U metabase ynab -c 'COPY transactions FROM STDIN' < transactions.tsv
psql -U metabase ynab -c 'COPY subtransactions FROM STDIN' < subtransactions.tsv
psql -U metabase ynab -c 'COPY scheduled_transactions FROM STDIN' < scheduled_transactions.tsv
psql -U metabase ynab -c 'COPY scheduled_subtransactions FROM STDIN' < scheduled_subtransactions.tsv

seq 1000000 | psql -U metabase ynab -c 'COPY ints FROM STDIN'