Set onDelete while using foreignKey function

Hi. I'm trying to set onDelete action with new "custom name" foreign key config. The problem is that I can not find such option. While FK defined through references it's possible as a second argument. Any ideas?
No description
3 Replies
Alex.dev
Alex.devOP13mo ago
@Dan Kochetov @Angelelz , please help if you have time, guys. Want to finish schema migration today
Angelelz
Angelelz13mo ago
I don't think this is in the docs. But your LSP might have been able to help you:
fk: foreignKey({
name: 'myKeyName',
columns: [table.myColumn],
foreignColumns: [anotherTable.foreignColumn]
}).onDelete('cascade').onUpdate('cascade')
fk: foreignKey({
name: 'myKeyName',
columns: [table.myColumn],
foreignColumns: [anotherTable.foreignColumn]
}).onDelete('cascade').onUpdate('cascade')
Alex.dev
Alex.devOP13mo ago
My man...I've tried everything except this obvious one. Thank you very much!
Want results from more Discord servers?
Add your server