Fix Detention date column and migrate database