Final touches to new db code + add migration tool.