From ad63122878e177d2517139b8fb88dddc1570af53 Mon Sep 17 00:00:00 2001 From: coolneng Date: Mon, 8 Feb 2021 01:34:54 +0100 Subject: [PATCH] Only recreate the database on the first run --- .gitignore | 1 + shell.nix | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..69557e7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +databases diff --git a/shell.nix b/shell.nix index e2ee9ea..40614cd 100644 --- a/shell.nix +++ b/shell.nix @@ -23,7 +23,10 @@ in mkShell { pg_ctl start -o "--unix_socket_directories=${data_dir} --listen_addresses='''" fi - psql -d postgres -f ${sql_file} + if [ ! -d ${data_dir} ]; then + psql -d postgres -f ${sql_file} + fi + alias psql='psql -d postgres' alias nuke='rm -rf ${data_dir}'