I don't know exactly how Wappler processes, but Jon's steps were the only way I was able to get it to work.
- Make some database change in Database Manager to create a migration file and add a record in wappler_migrations table.
- Go to the Change section and "Undo this Change"
- Open the migration file that was created and change the code to whatever custom code needed and save the file.
- Go back to the change and click "Appy this Change" (that option is not currently showing in the menu since I've already reapplied the change)
It's only after following these steps that the custom code (e.g. creating indexes) gets applied to the database.