First
DTDrizzle Team
•Created by First on 8/20/2024 in #help
Drizzle Migration but with TS code
Ah, my bad, found the GitHub issue (https://github.com/drizzle-team/drizzle-orm/discussions/1339) 🙇🏼♂️
7 replies
DTDrizzle Team
•Created by First on 8/20/2024 in #help
Drizzle Migration but with TS code
Found it, This is what I mean..
I think payloadCMS has some custom drizzle version made for them, like this
import type { DrizzleSnapshotJSON } from 'drizzle-kit/payload'
(code)
which they have a support of up()
and down()
function, where you can write your own typescript along with SQL by payload.db.drizzle.execute
and it would save into migration schema
This way, we could re-use a lot of SQL query by save into some utils file. e.g. we could have some trigger PSQL function that we might run every end of some migration, we could make the migration code cleaner by extract it into iteral string in TS.
here is a code (https://github.com/payloadcms/vercel-deploy-payload-postgres/blob/main/src/migrations/20240709_153941_initial.ts)
Not sure when the official drizzle-kit will support this kind of functionality?7 replies
DTDrizzle Team
•Created by First on 8/20/2024 in #help
Drizzle Migration but with TS code
Thank you!
7 replies
DTDrizzle Team
•Created by First on 8/20/2024 in #help
Drizzle Migration but with TS code
Drizzle doesn't provide any way to use TS code during migrations, you'd have to use SQLAh, sure then. seems it's not possible if I could leverage the migration schema created by drizzle to do some one-time scripting along with migration code. 🙇🏼♂️
7 replies