Enable pg_cron in a migration

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; I get the following error:
Error: Error starting database: ERROR:  can only create extension in database postgres
DETAIL:  Jobs must be scheduled from the database configured in cron.database_name, since the pg_cron background worker reads job de
scriptions 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) and only later renames it to
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.
Was this page helpful?