Can I Skip Code-Based Migration and Just Use drizzle-kit migrate?

I’m using Drizzle ORM and noticed there are two ways to run migrations: using the drizzle-kit migrate command and the code-based approach (migrate function). Do I need both, or can I rely solely on the drizzle-kit migrate command to handle my database migrations? What even is the difference between the two? Thanks for the help
6 Replies
Luc
Luc2mo ago
just use the cli, it uses the migrator under the hood saves you from writing a migrator file
jem
jemOP2mo ago
Thats what im currently using. Just generally curious whats the use case for the code-based approach.
Luc
Luc2mo ago
its for running migrations programmatically if you have logic that needs that
jem
jemOP2mo ago
watched some tutorials they all seem to use the code-based migration approach. I thought i was doing something wrong lol.
Kuba
Kuba2mo ago
The code-based migration comes handy when setting up integration tests. Both approaches are valid
jem
jemOP2mo ago
Oh that make more sense! Thanks!
Want results from more Discord servers?
Add your server