drizzle-team / drizzle-team/drizzle-orm

[FEATURE]: Add a way to mark migrations as applied

Open
#6,191 0 comments 0 reactions 0 assignees View on GitHub
enhancement
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

It would be useful if Drizzle Kit had a first-class command to mark a migration as already applied without executing it.

For example:

drizzle-kit migrate --mark-applied 0005_add_users

or perhaps:

drizzle-kit mark-applied 0005_add_users

The use case is when a migration has already been applied manually (or by another deployment mechanism), but Drizzle's migration journal doesn't know about it.

Currently, the workaround is to manually modify the Drizzle migrations table, which is error-prone and requires knowing the exact format/hash expected by the current Drizzle Kit version.

A built-in command could:

Verify that the migration exists locally
Calculate/verify its expected hash
Insert the appropriate record into the migrations table
Never execute the migration SQL
This would be especially useful for production databases where a migration has already been applied outside of Drizzle, or when adopting Drizzle on an existing migration history.

It would be great to have a safe, officially supported way to do this.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing Drizzle Kit's existing migrate command and migrations-table handling. Define how a mark-applied command should verify a local migration and its hash, record it without executing migration SQL, and support manually applied histories. Done means the behavior is safe and officially supported for production and existing migration histories.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql, typescript
Domain
cli, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.