diff options
| author | alex <alex@pdp7.net> | 2023-11-25 20:21:41 +0100 |
|---|---|---|
| committer | alex <alex@pdp7.net> | 2023-11-25 20:22:02 +0100 |
| commit | d90c659bcebbfb925e5709e55af4d0330ac7922c (patch) | |
| tree | 888824651dec833a1c5879809f770b0696b5877e /weight | |
| parent | caff5ee16d47615191ce15eeb562934d8bccc5b4 (diff) | |
Migrated from private repo
Diffstat (limited to 'weight')
| -rwxr-xr-x | weight/create_from_pdp7_pt | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/weight/create_from_pdp7_pt b/weight/create_from_pdp7_pt new file mode 100755 index 00000000..13e61ce9 --- /dev/null +++ b/weight/create_from_pdp7_pt @@ -0,0 +1,15 @@ +#!/bin/sh + +set -ue + +DB="postgresql://alex%40IPA.PDP7.NET@db.h2.int.pdp7.net" + +psql $DB -c "drop schema if exists weight cascade" +psql $DB -c "create schema weight" +psql $DB <schema.sql +psql $DB -c "create table weight.migrated(ts timestamp with time zone, value float)" + +psql "postgresql://pdp7_pt:pdp7_pt@devel.h2.int.pdp7.net/pdp7" -c '\copy (select "when", value from measures_floatmeasure join measures_measure on measures_measure.id = measures_floatmeasure.measure_ptr_id) to stdout' | psql $DB -c "\copy weight.migrated from stdin" + +psql $DB -c "insert into weight.weight(measured_at, value) select * from weight.migrated"; +psql $DB -c "drop table weight.migrated"; |
