Dropping primary keys every time
so latest drizzle-kit fixed a bunch of issues with dropping indexes and preserving pk order
but it's still dropping and recreating PKs every time
35 Replies
Are you pushing or migrating?
this is mysql push
yeah this is still a bummer, especially since "official" recommendation for planetscale has been to use push.
oof, this just straight breaks local development unless I drop all tables. this feels pretty critical so if I got time I will file an issue.
Update: already one filed:
GitHub
BUG: v0.20.2 push:mysql error: there can be only one auto column an...
When pushing schema changes to a Planetscale database, drizzle-kit attempts to drop the primary key, resulting in an unexpected error that crashes the program and does not push schema changes. Wind...
@thdxr curious if you're using drizzle in prod? If so, do you have workarounds for these drizzle kit issues? I've run into similar issues now and previously that have made me hesitant to switch
i use planetscale so this feature not being perfect isn't a huge deal
it does unnecessary work on my dev branch but the merge request on planetscale is still correct
long response from my side, sorry for this.
Taking this one and related introspect mysql issue
will be released next and asap
running into this too
it's fixed in
drizzle-kit@beta
seems like worked for other devs
will release it now
should be fixed in [email protected]
pushing after upgrading to latest gives me a new error š
0.19.3 (which I had before) worked (after manually deleting the table)
š
that's what I looked like too
cause the package definitely exports
relations
did you upgrade
drizzle-orm
as well?
also did drizzle-kit ask you to upgrade orm?first i upgrade both, that failed
then I only upgrade kit and it failed too
no it didn't ask
might be a monorepo thing?
It may be a monorepo thing, but I'm not sure yet.
On the 0.19 -> 0.20 upgrade, drizzle-kit requires a version of drizzle-orm that is 0.29.0 or higher, and you should definitely see a request to upgrade. This is done by fetching the internal version of drizzle-orm directly from drizzle-orm import
So, if you have more than one drizzle-orm package in your repository, I guess you need to upgrade all of them to 0.29.0 or higher when using drizzle-kit 0.20.0+
first i upgrade both, that failedWhat was an error there?
give me a few min, I'll do a fresh try
ah yeah we have a few
same error
I guess this was an issue
it seems like, but let's check
Invalid input Either "uri" or "host", "database" are required for database connectionok hold on, this is a completely new error š
yes
you need to change drizzle.config
connection key to be uri
it was changed to match a driver behavior
aah stupid zed has cached the old types
I'll think about how to handle this case of multiple drizzle-orm packages and how drizzle-kit can check all of them
because you was not the first
still fails on the 2nd push
same primary key drop?
ok, this one is a new error
checking
I guess I can fork unkey and check?
yeah, let me write down the instructions
oh
you are using new FK feature in planetscale?
that should be it
yeah
I guess we just need to check the behavior of it in PlanetScale
maybe some indexes are created automatically
and not seen in drizzle schema
I'll do all checks today and ping you back
thanks š
it's not super important, deleting the table is somewhat fine for us
planetscale migrations are handling it correctly afterwards, it's just annoying when we edit our schema in a development branch
It's definitely not the right behavior, and we are trying to make schema diffs close to the PlanetScale experience. Thanks for helping with that!
I'm 90% sure we just need to check a new FK behavior in PlanetScale
I did now get the warning btw
This version of drizzle-kit is outdated Please update drizzle-kit package to the latest version šsweet lmk how we can help š
@chronark fixed
really strange issue, will make more tests and deploy to beta tag for testing for you
the case was, that for some reason lower case for introspection query was not working with PlanetScale ans is working with MySQL
just making a query uppercase solved this issue
previously foreign keys were not fetched from PlanetScale and kit assumed you want to delete indexes related to FK and create those FK 1 more time
@chronark Whenever you are free, please check
drizzle-kit@beta
It will be released to the latest version either today or tomorrow morningsweet, will do later tonight
thank you so much!
I can confirm, I can push over it now š
thank you so much!
ā¤ļø
Perfect