From f38a0f2e1c62a636d5dd4f6cac244c60a5dfd2b8 Mon Sep 17 00:00:00 2001 From: Jeffrey Vervoort Date: Wed, 13 Dec 2023 09:35:13 +0100 Subject: [PATCH] Remove user --- datastore/storagebackend/postgresql/postgresql.go | 2 +- .../data/migrations/1701872471_initialise_schema.down.sql | 1 - migrate/data/migrations/1701872471_initialise_schema.up.sql | 6 ------ 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/datastore/storagebackend/postgresql/postgresql.go b/datastore/storagebackend/postgresql/postgresql.go index 3e19003..3dbb4d3 100644 --- a/datastore/storagebackend/postgresql/postgresql.go +++ b/datastore/storagebackend/postgresql/postgresql.go @@ -72,7 +72,7 @@ func NewPostgreSQL() (*PostgreSQL, error) { host := common.Getenv("PGHOST", "localhost") port := common.Getenv("PGPORT", "5433") - user := common.Getenv("PGUSER", "db_user") + user := common.Getenv("PGUSER", "postgres") password := common.Getenv("PGPASSWORD", "mysecretpassword") dbname := common.Getenv("PGDBNAME", "data") diff --git a/migrate/data/migrations/1701872471_initialise_schema.down.sql b/migrate/data/migrations/1701872471_initialise_schema.down.sql index 4953ff0..ba13745 100644 --- a/migrate/data/migrations/1701872471_initialise_schema.down.sql +++ b/migrate/data/migrations/1701872471_initialise_schema.down.sql @@ -2,5 +2,4 @@ -- DROP TABLE IF EXISTS observation; -- DROP TABLE IF EXISTS geo_point; -- DROP TABLE IF EXISTS time_series; --- DROP USER IF EXISTS db_user; -- DROP EXTENSION IF EXISTS postgis; diff --git a/migrate/data/migrations/1701872471_initialise_schema.up.sql b/migrate/data/migrations/1701872471_initialise_schema.up.sql index 2b5f6e6..dd7ae0c 100644 --- a/migrate/data/migrations/1701872471_initialise_schema.up.sql +++ b/migrate/data/migrations/1701872471_initialise_schema.up.sql @@ -72,9 +72,3 @@ CREATE TABLE observation ( PRIMARY KEY (ts_id, obstime_instant) ); - -CREATE USER db_user WITH NOSUPERUSER NOCREATEDB NOCREATEROLE PASSWORD 'mysecretpassword'; -ALTER ROLE db_user SET search_path TO public; -GRANT USAGE ON SCHEMA public TO db_user; -GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO db_user; -GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public to db_user;