Mysql 1093 error
Found it there #1609  `on_delete='CASCADE'`. Doesn't work on mysql 5.7.
i have to upgrade to mariadb 10.3.15 to have `UPDATE Statements With the Same Source and Target`
https://mariadb.com/kb/en/library/update/#update-statements-with-the-same-source-and-target MySQL has supported ON DELETE CASCADE for ages. Here it is documented in the 5.5 manual:

> CASCADE: Delete or update the row from the parent table, and automatically delete or update the matching rows in the child table. Both ON DELETE CASCADE and ON UPDATE CASCADE are supported.

MariaDB has similarly supported this for ages.

There is also of course the option to ON DELETE SET NULL.
I got this error after trying to delete a record which has dependency like this with mysql 5.7:

```
class Topic(BaseModel):
    class Meta:
        table_name = 'forum_topic'
    id = AutoField()

class Post(BaseModel):
    class Meta:
        table_name = 'forum_post'
    id = AutoField()
    reply_to: Post = ForeignKeyField(
        'self', null=True, default=None, backref='child_posts')
    topic = ForeignKeyField(Topic, null=True, default=None, backref='posts')
```

> peewee.InternalError: (1093, "You can't specify target table 'forum_post' for update in FROM clause")

generated query:

``('DELETE FROM `forum_post` WHERE (`forum_post`.`reply_to_id` IN (SELECT `forum_post`.`id` FROM `forum_post` AS `forum_post` WHERE (`forum_post`.`topic_id` = %s)))', [2])`


1093 error: In MySQL you can't delete from the same table you are selecting from.
https://dev.mysql.com/doc/refman/8.0/en/subquery-restrictions.html