drizzle-relations-generator
v0.0.1
Published
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 `
Downloads
6
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.
drizzle-rel-gen \
-snapshot="drizzle/meta/0000_snapshot.json" \
-src="index.ts" \
-module="./index" \
-outfile="generated.ts"