Fix indices and add migration