private static ModuleDBAdapter upgrade(ModuleManager moduleMgr, ModuleDBAdapter oldAdapter,
			TaskMonitor monitor) throws IOException, CancelledException {
		long treeID = moduleMgr.getTreeID();
		DBHandle handle = moduleMgr.getDatabaseHandle();
		DBHandle tmpHandle = new DBHandle();
		long id = tmpHandle.startTransaction();
		ModuleDBAdapter tmpAdapter = null;
		try {
			tmpAdapter = new ModuleDBAdapterV1(tmpHandle, true, treeID);
			RecordIterator it = oldAdapter.getRecords();
			while (it.hasNext()) {
				monitor.checkCancelled();
				DBRecord rec = it.next();
				tmpAdapter.updateModuleRecord(rec);
			}
			handle.deleteTable(getTableName(treeID));

			ModuleDBAdapter newAdapter = new ModuleDBAdapterV1(handle, true, treeID);
			it = tmpAdapter.getRecords();
			while (it.hasNext()) {
				monitor.checkCancelled();
				DBRecord rec = it.next();
				newAdapter.updateModuleRecord(rec);
			}
			return newAdapter;
		}
		catch (VersionException e) {
			throw new RuntimeException(e); // unexpected exception
		}
		finally {
			tmpHandle.endTransaction(id, true);
			tmpHandle.close();
		}
	}
Gets an adapter for working with the  program tree module database table.
@param moduleMgr module manager for corresponding program tree.
@param openMode the mode this adapter is to be opened for (CREATE, UPDATE, READ_ONLY, UPGRADE).
@param monitor task monitor
@return module table adapter
@throws VersionException if the database handle's version doesn't match the expected version.
@throws IOException if there is a problem accessing the database.
@throws CancelledException if task cancelled
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/module/ModuleDBAdapter.java