database optimizations

database schema modifications; datetime_upload -> datetime_created;
instant deletion of orphaned rows