Add database initialization

Runs fieldpoc with `--init` if there are no tables in the database.
This commit is contained in:
Jakob Lechner 2025-07-20 16:54:59 +02:00
parent adc5ad4b80
commit 795c828045

View file

@ -78,6 +78,10 @@ in {
if [ ! -f "/var/lib/fieldpoc/extensions.json" ]; then
echo '{"extensions": {}}' > /var/lib/fieldpoc/extensions.json
fi
if [ $(${config.services.postgresql.finalPackage}/bin/psql -q -t -A -c "select count(*) from information_schema.tables where table_schema='fieldpoc';") -eq 0 ]; then
${pkgs.fieldpoc}/bin/fieldpoc -c /run/fieldpoc/config.json --debug --init
fi
'';
};