Creating triggers with SQLite
How is everyone handling trigger statements at the moment? I've tried adding something like:
to the generated migration file, but it never ended up working properly. Are we supposed to just make transaction or batch functions instead?
5 Replies
Manually adding your trigger to a migration file before it's applied is the way to go unfortunately
I've tried doing this, but it doesn't seem to work--maybe I'm doing something wrong. This is what I'm adding to the end of my migration file:
After adding this, I just
npm exec drizzle-kit push:sqlite
to apply?Nope, push will not take your migration files
Into account
If you want to apply migrations with drizzle, you'll need to create a migration script
Drizzle ORM - next gen TypeScript ORM
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
It works now... my migration script was pointing to the wrong DB this whole time @Angelelz !
FWIW, I did make a working trigger function using a transaction: