Cron Jobs

The Cron Jobs component copies pg_cron scheduled tasks from the source project to the target project.

What Is pg_cron?

pg_cron is a PostgreSQL extension that allows you to schedule SQL commands at regular intervals, directly in the database. Examples:

  • Purging old data every day at midnight
  • Refreshing a materialized view every hour
  • Sending daily statistics

What Is Copied

For each cron job:

  • Name of the job
  • Schedule — cron expression (e.g. 0 * * * * for every hour)
  • Command — the SQL query executed
  • Target database

Key Considerations

SituationBehavior
Job with the same name on the targetRecreated (the old one is replaced)
Job referencing a functionThe function must exist on the target (clone the Functions component)
Job referencing a tableThe table must exist on the target (clone the Schema component)
pg_cron extension not enabledCloning this component will fail

Warning: Cron jobs run automatically once created. If a job performs critical actions (sending emails, deleting data), make sure the target environment is ready before cloning this component.

When to Use It

  • Full project migration
  • Staging needs the same scheduled tasks as production

When Not to Use It

  • Staging where automatic jobs could have unintended side effects (sending emails, billing, etc.)

Next Steps