Add database initialization
Runs fieldpoc with `--init` if there are no tables in the database.
This commit is contained in:
parent
e2c5ba1440
commit
8453ab9ae9
1 changed files with 4 additions and 0 deletions
|
|
@ -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
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue