import { drizzle } from "drizzle-orm/libsql"; import { routes } from "../db/schema.ts"; import * as schema from "../db/schema.ts"; import { db as db_type } from "../utils.ts"; import oldRecords from "./old-records.ts"; import newRecords from "./new-records.ts"; const db: db_type = drizzle( Deno.env.get("DB_FILE_NAME")! || (() => { throw "DB_FILE_NAME not set"; })() ); // clear old records & blobs // accounts could have deleted their sites or anything // so we should just nuke them // blobs could be kept but would be a nightmare await db.delete(routes); await Deno.remove("./blobs", { recursive: true }); oldRecords(db); newRecords(db); export default db;