Database
This post assume using PostgreSQL for database, check orm.drizzle.team/docs/overview for more information how to connnect to yo...
For further actions, you may consider blocking this person and/or reporting abuse
wouldnt mass updating the db like this mess up with its primary key sequence?
my bad, it wouldnt since you are not setting the primary key thus its auto incrementing on every user you insert. in my case tho i was passing the primary key manually so the sequence was not auto incrementing and was never updated and stayed at the last id in my case 1. so when i went and added a record without an id i got this error:
⨯ NeonDbError: duplicate key value violates unique constraint "users_pkey"
because it was trying to insert the record with an id of 1 but i already added a record with an id of 1.
to fix this i ran a query to update the primary key sequence like this after my seed script
Or you can use uuid's (generated with something like crypto.randomUUID) to not even care about this anymore
WRONG!
Which one is wrong ?
Nice, I like that you did not do the db updates in the loop, something many will fail at.
Can you share why does this happen?
I am using this approach and failing.
Nice write-up. I think
tsxpackage is better suited for the task. Here's an example.I dont see your scripts