Search code examples
phpormindexingredbean

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


I have an entity named 'account' which will have a username column and I want to index by this because I will be using it to lookup the username when logging in.

How do I tell redbean orm that I would like this table to have column 'username' to be indexed for faster lookup? Would I have to update the database manually instead of going through redbean orm?


Solution

  • I think this is what you're after:

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