When the database is initialized a check is made to verify that all indexes exist, if any are missing then they are created during initialization.
The code that does this is messy, difficult to read, not DRY, etc. and should be cleaned up and written in a more extensible fashion. Maybe macros/traits can be used to define indexes on the structs themselves?