managarten/packages/news-database/src/index.ts
Wuesteon d36b321d9d style: auto-format codebase with Prettier
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)
2025-11-27 18:33:16 +01:00

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