# drizzle-relations-generator

> This CLI utility generates drizzle ORM `relations()` code out of foreign key definitions (`.references(() => ...)`), this is useful if you've got a large schema that relies on foreign keys using the `.references(() => ...)` API and still want to use the `

Latest version **0.0.1** (published 2023-12-24) · 0 weekly downloads

## Install

```sh
npm install drizzle-relations-generator
pnpm add drizzle-relations-generator
yarn add drizzle-relations-generator
bun add drizzle-relations-generator
```

Provides the command `drizzle-rel-gen`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2023-12-24 |
| First published | 2023-12-24 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 4 |
| Unpacked size | 9.8 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| Maintainers | lqr471814 |

## Links

- npm: https://www.npmjs.com/package/drizzle-relations-generator
- npm.io page: https://npm.io/package/drizzle-relations-generator

## Dependencies (4)

- [zod](https://npm.io/package/zod.md) ^3.22.4
- [esbuild](https://npm.io/package/esbuild.md) ^0.19.10
- [jsflags](https://npm.io/package/jsflags.md) ^1.3.0
- [drizzle-orm](https://npm.io/package/drizzle-orm.md) ^0.29.1

## Recent versions

- 0.0.1 (latest) — 2023-12-24

## README

## drizzle-relations-generator

This CLI utility generates drizzle ORM `relations()` code out of foreign key definitions (`.references(() => ...)`), this is useful if you've got a large schema that relies on foreign keys using the `.references(() => ...)` API and still want to use the `db.query` API.

### Usage

```
Usage:
        -snapshot       string  The snapshot file under drizzle/meta to use. (ex. ./drizzle/meta/0000_snapshot.json)

        -src    string[]        The paths to the database schema file. (ex. ./path/to/file.ts)

        -module string[]        The module specifier(s) (ex. "./module/specifier" which would be then used in an import like 'import {} as "./module/specifier"') in the same order as '-src'.

        -outfile        string  The location to store the generated typescript file.
```

```bash
drizzle-rel-gen \
  -snapshot="drizzle/meta/0000_snapshot.json" \
  -src="index.ts" \
  -module="./index" \
  -outfile="generated.ts"
```

---
_Source: https://npm.io/package/drizzle-relations-generator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
