Migrating from Prisma gradually
We're in the middle of migrating away from Prisma to Drizzle which we just found out that Drizzle has its own naming convention for
FOREIGN KEY CONSTRAINT
.
To avoid surprises for this migration, we'd like to keep Prisma constraint names, I looked into the reference()
type definitions, it seems that we don't have a way to customise the FOREIGN KEY CONSTRAINT
name, is that correct?
At the same time, the current generated constraint name is longer than Postgres's allowed length. How can we workaround this?11 Replies
Yeah, known problem
We will definitely add custom names for any constraint we have
Will try to prioritize it
I’ll think on the best workaround for now and will ping you here
We will discuss it internally today and maybe I’ll include this fix in next release
thx!
If the constraint name is too long (the one auto-generated), it will be reduced but I don't know how, Postgres is still capable to find it with the full name.
@_@
this week i was updating some schema constraints and i discovered that the name I had in my sql migration didn't match what i had in db.
But no issue on droping it by its full name 🤷♂️
we just bumped into that on local @_@
this worked 😂
me and my far-too-long table names 😅
i guess you can manually edit your sql migration before deploying but you’ll have to remember that if you edit a constraint later 🥶
i guess you can manually edit your sql migration before deploying but you’ll have to remember that if you edit a constraint laterthis is what we wanna avoid, luckily andrew said it's something they can squeeze in
yeah he rocks 😎
@Cayter small update. Preparing kit release with ~15 github issues fixed
After that will work on custom names for constraints
Thx man!!!