Cascade delete not working
I have this schema:
When I try to delete all the musics from an album I get this error:
update or delete on table "musics" violates foreign key constraint "musics_to_authors_music_id_musics_id_fk" on table "musics_to_authors"
Here's my delete: await db.delete(musics).where(eq(musics.albumId, albumId))
I don't understand what I'm doing wrong5 Replies
End of schema:
Did you only add the
onDelete
action to Drizzle and not migrate/push it to your db?@Sillvva I did a push to my db
Any solutions found ? i run into this also using bun:sqlite delete cascade not working
I ended up deleting my db and creating it again and I haven't tested it again sorry