Add clean database and auto-detect database from code