database restructure