commits frfr
This commit is contained in:
parent
e0b483f344
commit
dcc647d085
6 changed files with 64 additions and 23 deletions
12
src/app.d.ts
vendored
12
src/app.d.ts
vendored
|
@ -1,3 +1,5 @@
|
|||
import type { D1Database, CacheStorage, Cache } from '@cloudflare/workers-types';
|
||||
|
||||
// See https://svelte.dev/docs/kit/types#app.d.ts
|
||||
// for information about these interfaces
|
||||
declare global {
|
||||
|
@ -6,7 +8,15 @@ declare global {
|
|||
// interface Locals {}
|
||||
// interface PageData {}
|
||||
// interface PageState {}
|
||||
// interface Platform {}
|
||||
interface Platform {
|
||||
env?: {
|
||||
HANDLES_DB: D1Database;
|
||||
}
|
||||
context: {
|
||||
waitUntil(promise: Promise<unknown>): void;
|
||||
};
|
||||
caches: CacheStorage & { default: Cache };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
import { drizzle } from 'drizzle-orm/libsql';
|
||||
import { createClient } from '@libsql/client';
|
||||
import { drizzle } from 'drizzle-orm/d1';
|
||||
import * as schema from './schema';
|
||||
import { env } from '$env/dynamic/private';
|
||||
|
||||
if (!env.DATABASE_URL) throw new Error('DATABASE_URL is not set');
|
||||
console.log(env.HANDLES_DB)
|
||||
|
||||
const client = createClient({ url: env.DATABASE_URL });
|
||||
|
||||
export const db = drizzle(client, { schema });
|
||||
export const db = drizzle(env.HANDLES_DB, { schema });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue