Skip to main content
Version: 0.15

Function: createDatabase()

createDatabase(connectionString): PostgresJsDatabase<Record<string, unknown>> & object

Defined in: src/db/index.ts:30

Create a Drizzle ORM database connection to a PostgreSQL instance.

Parameters

connectionString

string

PostgreSQL connection string (e.g. postgresql://user:pass@host:5432/db)

Returns

PostgresJsDatabase<Record<string, unknown>> & object

Drizzle database instance with the FreshGuard schema loaded

Example

import { createDatabase } from '@freshguard/freshguard-core';

const db = createDatabase(process.env.DATABASE_URL!);