Updated database build

Updated table scripts and the directory structure. Added a build script
(untested).