[database] fix some ID problems with databases