mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-28 07:30:04 +00:00
refactor(db): define the "TREK's tables" catalog query once
The bootstrap's currentTables and the client tools' pgTableNames each wrote the same information_schema query for the current schema, so a change to which tables count as TREK's would have had to land twice. It is now CURRENT_SCHEMA_TABLES_SQL in dialect/catalog.ts, beside the other catalog statements, and both read it. pgTableNames now lists its names in name order too, as the bootstrap already did. Nothing reads that order for meaning; the boot-restore refusal names the first few tables, and that list was already sorted.
This commit is contained in:
@@ -26,3 +26,12 @@ export function tableExistsSql(platform: Platform): string {
|
||||
}
|
||||
return unsupported(platform);
|
||||
}
|
||||
|
||||
/**
|
||||
* The tables in the current schema, one `table_name` per row in name order:
|
||||
* the schema TREK's own tables live in. Postgres only, and the one definition
|
||||
* of that question: the bootstrap reads it through the connection, the client
|
||||
* tools' table listing hands it to psql.
|
||||
*/
|
||||
export const CURRENT_SCHEMA_TABLES_SQL =
|
||||
'select table_name from information_schema.tables where table_schema = current_schema() order by table_name';
|
||||
|
||||
Reference in New Issue
Block a user