drizzle-team / drizzle-team/drizzle-orm
[FEATURE]: Add `drizzle-kit` command to evaluate changes between migrations and schema in CI
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Feature hasn't been suggested before.
- [x] I have verified this feature I'm about to request hasn't been suggested before.
### Describe the enhancement you want to request
I think it would be very helpful if there was a `drizzle-kit` command or flag, that would allow us to easily check if there are changes to our TypeScript based database schemas that have not had a migration generated.
I personally want this feature for:
1. CI/CD check to verify that schema changes are not left dangling and a migration has been generation.
2. As a pre-commit hook, so that before committing, I don't accidentally forget to generate a migration.
Here I have a few suggestions for what command this could be:
- `drizzle-kit check` <- add it to the existing check command (may break compatibility)
- `drizzle-kit check --diff` <- reuse check with a diff flag (backwards compatible)
- `drizzle-kit generate --dry-run` <- dry run, may not work well as resolution is interactive
- `drizzle-kit changes` <- completely new, only queries if/what changes exist
- `drizzle-kit ci` <- completely new, focused on improving CI experience, starting with this
Personally I think the latter two would be the nicest options, especially the last option could integrate very well with CIs utilizing exit codes.
I've skimmed through some of the code in the repository, and I feel confident that I can implement this feature myself, but before I start any work, we should discuss if this it a feature we want to implement, and if so, how we see fit to best implement this.
Contributor guide
Research direction
Start by reading the existing drizzle-kit check and generate command entry points, then trace how schema and migration changes are compared. Define which proposed command or flag should be supported, how it reports differences, and what exit behavior CI and pre-commit hooks require; done means ungenerated schema changes are reliably detected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ci-cd, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100