Autogenerate database mechanism