io avrei strutturato il database diversamente distinguendo progetti e versioni in 2 table diverse...