Skip to content

Commit 5775875

Browse files
authored
Merge pull request #7 from cepro/remove-properties-owner
Add corporate bodies grants with shared ownership support
2 parents 9df93c9 + e28afd9 commit 5775875

18 files changed

Lines changed: 844 additions & 91 deletions

.github/workflows/build-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
--health-retries 10
2626
2727
steps:
28-
- uses: actions/checkout@v4
28+
- uses: actions/checkout@v6
2929

3030
- name: Sqitch install
3131
run: docker pull sqitch/sqitch && curl -L https://git.io/JJKCn -o /usr/local/bin/sqitch && chmod +x /usr/local/bin/sqitch && sqitch --help
@@ -41,7 +41,7 @@ jobs:
4141
-f /sqitch/ci-bootstrap.sql
4242
4343
- name: Checkout flows-db
44-
uses: actions/checkout@v4
44+
uses: actions/checkout@v6
4545
with:
4646
repository: cepro/simt-flows-db
4747
path: flows-db

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ dumps/
33
*.secret.txt
44
.tmp
55
tmpdocs/
6+
opencode.json

bin/dump-local-supabase-db-data

Lines changed: 0 additions & 20 deletions
This file was deleted.

bin/dump-local-supabase-db-schema

Lines changed: 0 additions & 20 deletions
This file was deleted.

bin/dump-local-timescale-data

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
3+
DUMP_FILE=/db/timescale-local-data-`date +%s`.sql
4+
HOST_DIR=`pwd`/dumps
5+
6+
docker run \
7+
--rm \
8+
--network host \
9+
-v $HOST_DIR:/db \
10+
-v ~/.pgpass:/root/.pgpass:ro \
11+
postgres:17-alpine \
12+
pg_dump \
13+
--host localhost \
14+
--port 15432 \
15+
--dbname=tsdb \
16+
--username=tsdbadmin \
17+
--file=$DUMP_FILE \
18+
--schema=myenergy \
19+
--data-only \
20+
--inserts --column-inserts
21+
22+
echo "Dumped to $HOST_DIR/`basename $DUMP_FILE`"

bin/dump-local-timescale-schema

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
3+
DUMP_FILE=/db/timescale-local-schema-`date +%s`.sql
4+
HOST_DIR=`pwd`/dumps
5+
6+
docker run \
7+
--rm \
8+
--network host \
9+
-v $HOST_DIR:/db \
10+
-v ~/.pgpass:/root/.pgpass:ro \
11+
postgres:17-alpine \
12+
pg_dump \
13+
--host localhost \
14+
--port 15432 \
15+
--dbname=tsdb \
16+
--username=tsdbadmin \
17+
--file=$DUMP_FILE \
18+
--schema=myenergy \
19+
--clean --if-exists --schema-only
20+
21+
echo "Dumped to $HOST_DIR/`basename $DUMP_FILE`"

bin/lint

Lines changed: 0 additions & 2 deletions
This file was deleted.

bin/restore-local-supabase-db-data

Lines changed: 0 additions & 25 deletions
This file was deleted.

bin/restore-local-timescale-data

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
3+
if [ -z "$1" ]
4+
then
5+
echo "No backup file specified"
6+
return 1
7+
fi
8+
9+
DUMP_FILE=$1
10+
11+
HOST_DIR=/tmp/timescale-restore
12+
mkdir -p $HOST_DIR
13+
cp $DUMP_FILE $HOST_DIR
14+
15+
docker run \
16+
--rm \
17+
--network host \
18+
-v $HOST_DIR:/db \
19+
-v ~/.pgpass:/root/.pgpass:ro \
20+
postgres:17-alpine \
21+
psql \
22+
--log-file=/db/restore.log \
23+
--host localhost \
24+
--port 15432 \
25+
--username=tsdbadmin \
26+
--dbname=tsdb \
27+
--file=/db/$DUMP_FILE

sqitch/deploy/0000_initial.sql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -732,12 +732,11 @@ BEGIN
732732
occupier_id := owner_id;
733733
END IF;
734734

735-
-- Create property
736-
INSERT INTO myenergy.properties (plot, description, owner, esco, id)
735+
-- Create property (owner column removed in 0020_shared_ownership_removal - use registered_proprietors instead)
736+
INSERT INTO myenergy.properties (plot, description, esco, id)
737737
VALUES (
738738
'Plot-' || plot_number,
739739
description,
740-
owner_id,
741740
esco_id,
742741
property_id
743742
);

0 commit comments

Comments
 (0)