How to do a foreign key with cascades

Right now I'm doing something like this:

mysqlTable('users',
    {
        id: varchar('id', { length: 36 }).notNull().default('uuid-will-be-generated').primaryKey(),
        avatarId: varchar('avatarId', { length: 36 }).default(null).references(() => S3FileTable.id, { onDelete: "set null", onUpdate: "no action" })
    },
);

I would like to name the key that is generated here. I understand that I can use the foreignKey() to name the key. However, I don't know how to handle the cascades if I do the foreign key using that function rather than using references().

Can anybody give me a pointer?
Was this page helpful?