update database.sql; weed out last duplicate gateways, update users accordingly