# Database Helper - PostgreSQL

This package contains all database-related configuration, migrations, and schema definitions for the PostgreSQL database.

## Structure

- `src/db/` - Database source files
  - `schema.ts` - Drizzle ORM schema definitions
  - `db_index.ts` - Database connection and client setup
  - `types.ts` - Database types
  - `seed.ts` - Database seeding script
  - `porter.ts` - Data migration utilities
- `drizzle/` - Migration files generated by Drizzle Kit
- `drizzle.config.ts` - Drizzle Kit configuration

## Environment Variables

Create a `.env` file with:

```
DATABASE_URL=postgresql://username:password@localhost:5432/dbname
```

## Scripts

- `npm run migrate` - Generate new migration files
- `npm run db:push` - Push schema changes to database
- `npm run db:seed` - Run database seeding
- `npm run db:studio` - Open Drizzle Studio

## Usage

This package can be used by other packages/apps in the monorepo:

```typescript
import { db } from '@packages/db_helper_postgres/src/db/db_index';
import { users } from '@packages/db_helper_postgres/src/db/schema';
```
