diff --git a/init.sql b/init.sql index aad2144..253baff 100644 --- a/init.sql +++ b/init.sql @@ -14,11 +14,15 @@ END IF; END $do$; --- Grant full permissions on this database +-- Grant privileges on the database GRANT ALL PRIVILEGES ON DATABASE keepalive TO keepalive; -- Connect to the database -\c keepalive; +\c keepalive + +-- Ensure the user can use the public schema +GRANT USAGE ON SCHEMA public TO keepalive; +GRANT CREATE ON SCHEMA public TO keepalive; -- Create the table for key/value counters CREATE TABLE IF NOT EXISTS keepalive ( @@ -26,6 +30,9 @@ CREATE TABLE IF NOT EXISTS keepalive ( value BIGINT NOT NULL ); +-- Grant all privileges on the table to the user +GRANT ALL PRIVILEGES ON TABLE keepalive TO keepalive; + -- Initialize key/value INSERT INTO keepalive (key, value) VALUES ('counter', 0)