Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/issuer/bin/start-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { join } from "node:path"
import { getDb } from "@/db/get-db"
import app from "@/index"
import { serve } from "@hono/node-server"
import { migrate } from "drizzle-orm/better-sqlite3/migrator"
import { migrate } from "drizzle-orm/libsql/migrator"

function startServer() {
async function startServer() {
const db = getDb()

migrate(db, {
await migrate(db, {
migrationsFolder: join(
import.meta.dirname,
"..",
Expand All @@ -28,4 +28,4 @@ function startServer() {
)
}

startServer()
void startServer()
3 changes: 1 addition & 2 deletions examples/issuer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
},
"dependencies": {
"@hono/node-server": "catalog:",
"@libsql/client": "0.15.15",
"@repo/api-utils": "workspace:*",
"agentcommercekit": "workspace:*",
"better-sqlite3": "11.10.0",
"bit-buffers": "catalog:",
"drizzle-orm": "0.43.1",
"hono": "catalog:",
Expand All @@ -39,7 +39,6 @@
"devDependencies": {
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/better-sqlite3": "7.6.13",
"drizzle-kit": "0.31.1",
"vite-tsconfig-paths": "5.1.4"
}
Expand Down
10 changes: 5 additions & 5 deletions examples/issuer/src/db/get-db.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import SqliteDatabase from "better-sqlite3"
import { drizzle } from "drizzle-orm/better-sqlite3"
import { createClient } from "@libsql/client"
import { drizzle } from "drizzle-orm/libsql"
import * as schema from "./schema"

/**
Expand All @@ -8,9 +8,9 @@ import * as schema from "./schema"
* @param url - The SQLite database URL.
* @returns A Drizzle client.
*/
export function getDb(url = "sqlite.db") {
const sqlite = new SqliteDatabase(url)
return drizzle({ client: sqlite, schema })
export function getDb(url = "file:sqlite.db") {
const client = createClient({ url })
return drizzle({ client, schema })
}

export type DatabaseClient = ReturnType<typeof getDb>
Loading