-- Grant necessary permissions to the Nextcloud PostgreSQL user -- CREATEROLE allows creating roles for Nextcloud apps ALTER USER {{ nextcloud_postgres_user }} WITH CREATEROLE; -- Pre-create the Nextcloud database to prevent automatic user creation CREATE DATABASE {{ nextcloud_postgres_db }} OWNER {{ nextcloud_postgres_user }}; -- Grant CREATE permission on public schema in the new database \c {{ nextcloud_postgres_db }} GRANT CREATE ON SCHEMA public TO {{ nextcloud_postgres_user }};