Jcuevas
Jcuevas
DTDrizzle Team
Created by Jcuevas on 2/1/2025 in #help
Pkey violates unique constraint after Seed
After i add data to the DB with some data and i try to do an insert, i get the error: duplicate key value violates unique constraint "users_pkey". I can get around it by
await db.execute(sql.raw(
`ALTER SEQUENCE users_id_seq RESTART WITH ${Math.max(...users.map(u => u.id)) + 1}`
));
await db.execute(sql.raw(
`ALTER SEQUENCE users_id_seq RESTART WITH ${Math.max(...users.map(u => u.id)) + 1}`
));
but i was wondering if there was something im doing wrong when inserting? I dont use seed and have a script that runs and inserts data to the db, basicalli make to db connections. Not sure if that affects it
1 replies
DTDrizzle Team
Created by Jcuevas on 1/4/2025 in #help
1:1 disambiguating relations on parent
No description
1 replies