When using a foreignKey({}), is there a way to specify onDelete: "cascade'?

I'm looking to custom name my foreign keys so I need to use the foreignKey() function. However, how can I specify an action: {onDelete: "cacade"} using this function?
  userIdReference: foreignKey(
    {
      columns: [table.userId],
      foreignColumns: [users.userId],
      name: "accounts_user_id_fk",
    },
  ),


To my understanding, if I use the .references() method, it doesn't allow for naming foreign keys
userId: integer('user_id').references(() => users.id, { onDelete: 'cascade' })
Was this page helpful?