preciazo/db-datos/migrate.js

14 lines
433 B
JavaScript
Raw Normal View History

// @ts-check
import { migrate } from "drizzle-orm/better-sqlite3/migrator";
2023-12-23 23:29:55 +00:00
import * as schema from "./schema.js";
2024-01-24 23:13:20 +00:00
import { sql } from "drizzle-orm";
2023-12-23 23:29:55 +00:00
2024-01-24 23:13:20 +00:00
/**
* @param {import("drizzle-orm/better-sqlite3").BetterSQLite3Database<schema>} db
*/
export function migrateDb(db) {
migrate(db, { migrationsFolder: "node_modules/db-datos/drizzle" });
db.run(sql`pragma journal_mode = WAL;`);
db.run(sql`PRAGMA synchronous = NORMAL;`);
2023-12-26 03:03:28 +00:00
}