fix: reach the log-retention job into _supabase over dblink
the supabase image pins cron.database_name to postgres, so pg_cron refuses jobs scheduled from _supabase, where the log tables live; 1.3.2's upgrade failed on the first live run with 'can only create extension in database postgres'. The job now runs in postgres and deletes the _analytics log_events_* rows in _supabase over a local dblink connection, which needs no password because the image trusts local connections for supabase_admin. version 1.3.3
This commit is contained in:
@@ -134,11 +134,15 @@ class Values(unittest.TestCase):
|
||||
def test_log_retention_sql(self):
|
||||
# Logflare stores logs in _analytics.log_events_* and never deletes them; the job deletes
|
||||
# rows older than LOG_RETENTION and is scheduled under a fixed name so re-runs overwrite.
|
||||
self.assertIn("schemaname = '_analytics'", sp.RETENTION_SQL)
|
||||
self.assertIn("like 'log_events\\_%'", sp.RETENTION_SQL)
|
||||
# pg_cron in the supabase image only runs jobs from the `postgres` database, so the job
|
||||
# reaches the log tables in `_supabase` over a local dblink connection (trusted there).
|
||||
self.assertIn("schemaname = ''_analytics''", sp.RETENTION_SQL)
|
||||
self.assertIn("''log_events\\_%''", sp.RETENTION_SQL)
|
||||
self.assertIn(f"interval ''{sp.LOG_RETENTION}''", sp.RETENTION_SQL)
|
||||
self.assertIn(f"'{sp.LOG_RETENTION_JOB}'", sp.RETENTION_SQL)
|
||||
self.assertIn("cron.schedule", sp.RETENTION_SQL)
|
||||
self.assertIn("dblink_connect", sp.RETENTION_SQL)
|
||||
self.assertIn("user=supabase_admin", sp.RETENTION_SQL)
|
||||
|
||||
def test_imgproxy_reads_the_storage_volume(self):
|
||||
img = self.v["persistence"]["imgproxy"]
|
||||
|
||||
Reference in New Issue
Block a user