Browse Source

PostgreSQL move initialScript after ensures

Signed-off-by: Magic_RB <magic_rb@redalder.org>
master
Magic_RB 2 weeks ago
parent
commit
f3929584d7
Signed by: Magic_RB GPG Key ID: 08D5287CC5DDCA0E
1 changed files with 7 additions and 7 deletions
  1. +7
    -7
      modules/services/postgresql.nix

+ 7
- 7
modules/services/postgresql.nix View File

@ -392,13 +392,6 @@ in
sleep 0.1
done
if test -e "${cfg.dataDir}/.first_startup"; then
${optionalString (cfg.initialScript != null) ''
$PSQL -f "${cfg.initialScript}" -d postgres
''}
rm -f "${cfg.dataDir}/.first_startup"
fi
${concatMapStrings (database: ''
$PSQL -tAc "SELECT 1 FROM pg_database WHERE datname = '${database}'" | grep -q 1 || $PSQL -tAc 'CREATE DATABASE "${database}"'
'') cfg.ensureDatabases}
@ -418,6 +411,13 @@ in
) schemas
) cfg.ensureExtensions)}
if test -e "${cfg.dataDir}/.first_startup"; then
${optionalString (cfg.initialScript != null) ''
$PSQL -f "${cfg.initialScript}" -d postgres
''}
rm -f "${cfg.dataDir}/.first_startup"
fi
wait $postgresql
'';
# -- END MIT LICENSED CODE


Loading…
Cancel
Save