Issue on login history and fix postgreSQL tables structures