jeremy
DTDrizzle Team
•Created by jeremy on 6/8/2024 in #help
(Next)Auth.js Drizzle Schema
Also I am on version
drizzle-kit: v0.22.6
drizzle-orm: v0.31.2
18 replies
DTDrizzle Team
•Created by jeremy on 6/8/2024 in #help
(Next)Auth.js Drizzle Schema
Note on the database side the index
authenticator_userId_credentialID_pk
does exist with 18 replies
DTDrizzle Team
•Created by jeremy on 6/8/2024 in #help
(Next)Auth.js Drizzle Schema
Actually, I am not certain of the above anymore.
When the table looks like this:
Running
drizzle-kit generate
outputs the following SQL statement,
and running drizzle-kit push
executes the following statement
which is the same. Yet, running drizzle-kit push
again reutrns this:
I am a bit confused at what's going on.18 replies
DTDrizzle Team
•Created by jeremy on 6/8/2024 in #help
(Next)Auth.js Drizzle Schema
My guess is that the column order of the primary key when using
drizzle-kit generate
is as given, while when using drizzle-kit push
, it is ordered alphabetically?18 replies
DTDrizzle Team
•Created by jeremy on 6/8/2024 in #help
(Next)Auth.js Drizzle Schema
I suspect this is the related issue, but not certain:
https://github.com/drizzle-team/drizzle-orm/issues/2326
18 replies
DTDrizzle Team
•Created by jeremy on 6/8/2024 in #help
(Next)Auth.js Drizzle Schema
Anyway, I think I have actually figured it out, the following code works and is able to be pushed fine:
Notice the order of the columns [credentiald, userId]. I imagine the property name of the object (in this case,
pk
, but in the Auth.js schema compositePK
) doesn't matter, but for some reason, the order of the columns makes a difference.
Here are the results for different variations of the above after deleting the table authenticators
and then running drizzle-kit push
:
18 replies
DTDrizzle Team
•Created by jeremy on 6/8/2024 in #help
(Next)Auth.js Drizzle Schema
it appears i have spoken too soon
18 replies
DTDrizzle Team
•Created by jeremy on 6/8/2024 in #help
(Next)Auth.js Drizzle Schema
i figured it out (deleted the table and migrated again and pushed again and it worked :love:)
18 replies
DTDrizzle Team
•Created by jeremy on 6/8/2024 in #help
(Next)Auth.js Drizzle Schema
tho its essentially a carbon copy of what auth.js recommends except i just changed all the composite primary keys property names to pk
18 replies
DTDrizzle Team
•Created by jeremy on 6/8/2024 in #help
(Next)Auth.js Drizzle Schema
my schema.ts also if that is helpful
18 replies
DTDrizzle Team
•Created by jeremy on 6/8/2024 in #help
(Next)Auth.js Drizzle Schema
also fyi the next authjs documentation still uses the old migrator script for migration instead of the drizzle-kit migrate command
18 replies
DTDrizzle Team
•Created by jeremy on 6/8/2024 in #help
(Next)Auth.js Drizzle Schema
i love u guys ur twt once qrtd me
18 replies
DTDrizzle Team
•Created by jeremy on 6/8/2024 in #help
(Next)Auth.js Drizzle Schema
drizzle-kit check gets me Everything's fine 🐶🔥 and this is what drizzle-kit introspect gets me (images above)
18 replies