Speed up issue search

This commit is contained in:
dotta 2026-04-06 20:30:50 -05:00
parent 0edac73a68
commit 5136381d8f
15 changed files with 13127 additions and 27 deletions

View file

@ -45,6 +45,11 @@ type TableDefinition = {
tablename: string;
};
type ExtensionDefinition = {
extension_name: string;
schema_name: string;
};
const DRIZZLE_SCHEMA = "drizzle";
const DRIZZLE_MIGRATIONS_TABLE = "__drizzle_migrations";
const DEFAULT_BACKUP_WRITE_BUFFER_BYTES = 1024 * 1024;
@ -340,6 +345,25 @@ export async function runDatabaseBackup(opts: RunDatabaseBackupOptions): Promise
emit("");
}
const extensions = await sql<ExtensionDefinition[]>`
SELECT
e.extname AS extension_name,
n.nspname AS schema_name
FROM pg_extension e
JOIN pg_namespace n ON n.oid = e.extnamespace
WHERE e.extname <> 'plpgsql'
ORDER BY e.extname
`;
if (extensions.length > 0) {
emit("-- Extensions");
for (const extension of extensions) {
emitStatement(
`CREATE EXTENSION IF NOT EXISTS ${quoteIdentifier(extension.extension_name)} WITH SCHEMA ${quoteIdentifier(extension.schema_name)};`,
);
}
emit("");
}
if (sequences.length > 0) {
emit("-- Sequences");
for (const seq of sequences) {