commits frfr

This commit is contained in:
Lara 2025-04-03 23:40:52 +03:00
parent e0b483f344
commit dcc647d085
Signed by: laratheprotogen
GPG key ID: 5C0296EB3165F98B
6 changed files with 64 additions and 23 deletions

12
src/app.d.ts vendored
View file

@ -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 };
}
}
}

View file

@ -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 });