From ffa9e5dfab7a1d7ea84d88007107f9f40295c50a Mon Sep 17 00:00:00 2001
From: Andre Borie <hi@rjevski.io>
Date: Sun, 17 Jan 2021 01:44:31 +0000
Subject: Make migrations (mostly) idempotent.

---
 config/sql/users.sql | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'config/sql/users.sql')

diff --git a/config/sql/users.sql b/config/sql/users.sql
index 0f2cdba2..ad002ec2 100644
--- a/config/sql/users.sql
+++ b/config/sql/users.sql
@@ -2,7 +2,7 @@
 
 -- DROP TABLE public.users;
 
-CREATE TABLE public.users
+CREATE TABLE IF NOT EXISTS public.users
 (
   updated timestamp with time zone,
   notifications text[],
@@ -16,13 +16,13 @@ CREATE TABLE public.users
   CONSTRAINT users_email_key UNIQUE (email)
 );
 
-GRANT ALL ON TABLE public.users TO kemal;
+GRANT ALL ON TABLE public.users TO current_user;
 
 -- Index: public.email_unique_idx
 
 -- DROP INDEX public.email_unique_idx;
 
-CREATE UNIQUE INDEX email_unique_idx
+CREATE UNIQUE INDEX IF NOT EXISTS email_unique_idx
   ON public.users
   USING btree
   (lower(email) COLLATE pg_catalog."default");
-- 
cgit v1.2.3

