当使用RedBean PHP ORM时,如何确保表被某个列索引


How to make sure a table is indexed by a certain column when using RedBean PHP ORM?

我有一个名为"account"的实体,它将有一个用户名列,我想以此为索引,因为登录时我将使用它来查找用户名。

我如何告诉redbean orm我希望这个表有列"username"进行索引,以便更快地查找?我是否必须手动更新数据库,而不是通过redbean orm?

我想这就是你想要的:

R::$writer->addIndex('account','userindex','username');