mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
## Context Related to FE-2557 Part of shifting manually written dashboard queries into packages/pg-meta where - pg-meta can be code owners of - we can write tests for the queries This PR just shifts all the `.sql.ts` files that we previously created into packages/pg-meta There's still other areas where we need to shift over as well which I'll address in subsequent PRs ## Notable changes - `getTableRowsCountSql` -> Opted to shift `formatFilterValue` logic out before calling this method (ref `table-rows-count-query`) - `getDeleteOldCronJobRunDetailsByCtidSql` -> Opted to shift `validatePageNumber` logic out before calling this method (ref `CronJobsTab.useCleanupActions`)
13 lines
496 B
TypeScript
13 lines
496 B
TypeScript
// Number of pages to process in each batch for ctid-based deletion
|
|
// Based on default Postgres shared buffer size of 128 MB, which fits ~16k pages
|
|
export const CTID_BATCH_PAGE_SIZE = 5_000
|
|
|
|
/**
|
|
* Validates that a value is a finite non-negative integer.
|
|
*/
|
|
export function validatePageNumber(value: number, name: string): void {
|
|
if (!Number.isFinite(value) || !Number.isInteger(value) || value < 0) {
|
|
throw new Error(`${name} must be a finite non-negative integer, got: ${value}`)
|
|
}
|
|
}
|