[WIP] A (somewhat barebones) atproto app for creating custom sites without hosting!
1import { drizzle } from "drizzle-orm/libsql";
2import { routes } from "../db/schema.ts";
3import * as schema from "../db/schema.ts";
4import { db as db_type } from "../utils.ts";
5import oldRecords from "./old-records.ts";
6import newRecords from "./new-records.ts";
7
8const db: db_type = drizzle<typeof schema>(
9 Deno.env.get("DB_FILE_NAME")! ||
10 (() => {
11 throw "DB_FILE_NAME not set";
12 })()
13);
14
15// clear old records & blobs
16// accounts could have deleted their sites or anything
17// so we should just nuke them
18// blobs could be kept but would be a nightmare
19await db.delete(routes);
20await Deno.remove("./blobs", { recursive: true });
21
22oldRecords(db);
23newRecords(db);
24
25export default db;