© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•2y ago
titongo

How should I do custom migrations?

I am trying to do migrations in sqlite and sometimes drizzle will leave a comment in the migration file saying it cannot add constraints to existing columns, I understand it is necessary but it'd be appreciated if there was better documentation on how to achieve these things without leaving drizzle too much.
I feel like the whole migration process from drizzle-kit is not that clear and its quite hard to understand what are its limitations. For instance, I had a 0005_etc migration file written by me (I guess this is necessary to keep it version-controllable) and it used
BEGIN TRANSACTION;
BEGIN TRANSACTION;

Now, trying to run my 0006_etc file I am getting
SQL_MANY_STATEMENTS
SQL_MANY_STATEMENTS
and if I add statement-breakpoints I get
SQLite error: cannot start a transaction within a transaction
SQLite error: cannot start a transaction within a transaction
I am unsure about whether it has to do with this file or the previous one. Some of the questions that I am now getting:
- Does running
drizzle-kit migrate
drizzle-kit migrate
run all files? how does it decide which to run?
- Why can't it point me to the file/statement that is erroring?
- how are
--> statement-breakpoint
--> statement-breakpoint
s used?
- Can I turn on/off foreign keys during migrations?
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How do I apply migrations on cloudflare workers?
Drizzle TeamDTDrizzle Team / help
2y ago
Custom SQL in migrations
Drizzle TeamDTDrizzle Team / help
3y ago
how do I add custom constraint?
Drizzle TeamDTDrizzle Team / help
2y ago
How can I reset migrations timestamp
Drizzle TeamDTDrizzle Team / help
2y ago