drizzle-team / drizzle-team/drizzle-orm
[FEATURE]: `drizzle-kit generate` options for `--from-schema-datamodel` and `--to-schema-datamodel`?
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Describe what you want
From drizzle-kit-mirror repo: https://github.com/drizzle-team/drizzle-kit-mirror/issues/559.
> Similar to [`prisma migrate diff`](https://www.prisma.io/docs/orm/reference/prisma-cli-reference#migrate-diff), allow for passing schema file paths as the "from" and "to" when generating migrations:
> Options Description
> `--from-schema-datamodel` Path to a Prisma schema file, uses the data model for the diff
> `--to-schema-datamodel` Path to a Prisma schema file, uses the data model for the diff
>
> This would allow for richer migrations generation workflows, as in [the `prisma migrate` workflows docs](https://www.prisma.io/docs/orm/prisma-migrate/workflows).
>
> My own use case is not mentioned on that link:
>
> I am trying to generate a file with SQL queries containing the current PostgreSQL schema diff for a PR, based on our own homegrown [SQL-in-JS schemas](https://github.com/drizzle-team/drizzle-orm/issues/2909).
>
> With the `--from-schema-datamodel` and `--to-schema-datamodel` options (or similar options with other names), I imagine I could run `drizzle-kit generate` as follows in CI to autogenerate the migrations:
>
> ```shell
> drizzle-kit generate --from-schema-datamodel main-schema.ts --to-schema-datamodel feature-schema.ts
> # then commit to Git in the CI step
> ```
Contributor guide
Assessment
This issue has not been assessed yet.