semi working upgrade queries
added DbStructure and organized code