Fix db migrations deadlock