From a25d6c975588282fbe3701ce79c9b8693e4608c3 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 5 Sep 2023 17:25:14 -0500 Subject: [PATCH] db: pragma, enable fk constraints, enable autovacuum full --- src/db/migrations/006_pragma.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/db/migrations/006_pragma.ts diff --git a/src/db/migrations/006_pragma.ts b/src/db/migrations/006_pragma.ts new file mode 100644 index 0000000..e9dbad1 --- /dev/null +++ b/src/db/migrations/006_pragma.ts @@ -0,0 +1,12 @@ +import { Kysely, sql } from '@/deps.ts'; + +export async function up(db: Kysely): Promise { + await sql`PRAGMA foreign_keys = ON`.execute(db); + await sql`PRAGMA auto_vacuum = FULL`.execute(db); + await sql`VACUUM`.execute(db); +} + +export async function down(db: Kysely): Promise { + await sql`PRAGMA foreign_keys = OFF`.execute(db); + await sql`PRAGMA auto_vacuum = NONE`.execute(db); +}