From 6b60f5f64ab9d7598ccdb2545b0e5560991ff5f3 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 4 Dec 2017 02:06:05 +0300 Subject: [PATCH] made psql script compatible with migrations or generate_config reruns --- lib/mix/tasks/sample_psql.eex | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/mix/tasks/sample_psql.eex b/lib/mix/tasks/sample_psql.eex index 5353fa216..9eb7f65b0 100644 --- a/lib/mix/tasks/sample_psql.eex +++ b/lib/mix/tasks/sample_psql.eex @@ -1,6 +1,8 @@ -CREATE USER pleroma WITH ENCRYPTED PASSWORD '<%= dbpass %>' CREATEDB; -CREATE DATABASE pleroma_dev; +CREATE USER IF NOT EXISTS pleroma WITH ENCRYPTED PASSWORD '<%= dbpass %>' CREATEDB; +-- in case someone runs this second time accidentally +ALTER USER pleroma WITH ENCRYPTED PASSWORD '<%= dbpass %>' CREATEDB; +CREATE DATABASE IF NOT EXISTS pleroma_dev; ALTER DATABASE pleroma_dev OWNER TO pleroma; \c pleroma_dev; --Extensions made by ecto.migrate that need superuser access -CREATE EXTENSION citext; +CREATE EXTENSION IF NOT EXISTS citext; -- 2.45.2