mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-19 12:01:24 +02:00
Applied formatting to 1487+ files using pnpm format:write - TypeScript/JavaScript files - Svelte components - Astro pages - JSON configs - Markdown docs 13 files still need manual review (Astro JSX comments)
19 lines
627 B
TypeScript
19 lines
627 B
TypeScript
import { drizzle, PostgresJsDatabase } from 'drizzle-orm/postgres-js';
|
|
import postgres from 'postgres';
|
|
import * as schema from './schema';
|
|
|
|
// Re-export schema and types
|
|
export * from './schema';
|
|
export { sql, eq, and, or, desc, asc, isNull, isNotNull, inArray } from 'drizzle-orm';
|
|
|
|
// Export schema for use in drizzle initialization
|
|
export { schema };
|
|
|
|
// Type for the database instance with schema
|
|
export type Database = PostgresJsDatabase<typeof schema>;
|
|
|
|
// Helper to create a new database connection
|
|
export function createDb(url: string): Database {
|
|
const client = postgres(url);
|
|
return drizzle(client, { schema });
|
|
}
|