I'm currently trying to use the pg_cron extension. However when I try to enable it in a migration using
CREATE EXTENSION pg_cron;
CREATE EXTENSION pg_cron;
I get the following error:
Error: Error starting database: ERROR: can only create extension in database postgresDETAIL: Jobs must be scheduled from the database configured in cron.database_name, since the pg_cron background worker reads job descriptions from this database.HINT: Add cron.database_name = 'main' in postgresql.conf to use the current database.CONTEXT: PL/pgSQL function inline_code_block line 4 at RAISE
Error: Error starting database: ERROR: can only create extension in database postgresDETAIL: Jobs must be scheduled from the database configured in cron.database_name, since the pg_cron background worker reads job descriptions from this database.HINT: Add cron.database_name = 'main' in postgresql.conf to use the current database.CONTEXT: PL/pgSQL function inline_code_block line 4 at RAISE
It's probably because the Supabase CLI creates a database named after the current branch (default
main
main
) and only later renames it to
postgres
postgres
. Is there a way around this? If I try to enable the extension after I started the server it does work however I need to be able to use it in migrations.
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.