public final function upgrade($db, $toVer, $fromVer = '0.0.0') {
		if ($fromVer !== '0.0.0' && !$db->select('id')->from('{module}')->where(['name' => $this->namespace])->exist('id')) {
			return false;
		}
		$prev = $fromVer;
		foreach ($this->getVersionList() as $ver => $chang) {
			$func = 'upgradeTo' . str_replace('.', '_', $ver);
			if (version_compare($ver, $toVer, '<=') && version_compare($ver, $fromVer, '>')) {
				$sqls = $this->getSchemaSQLs($ver, $prev);
				$prev = $ver;
				if ($sqls) {
					$sr = ['{prefix}', '{encoding}'];
					$rp = [$db->getDialect()->getTablePrefix(), $db->getDialect()->getCharset()];
					foreach ($sqls as $_sql) {
						if (!$_sql) {
							continue;
						}
						$_sql = (array)$_sql;
						foreach ($_sql as $sql) {
							$sql = str_replace($sr, $rp, $sql);
							$rst = $db->exec($sql);
							if (!$rst) {
								throw_exception($db->error);
							}
						}
					}
				}
				if ($func && method_exists($this, $func)) {
					$rst = $this->{$func}($db);
					if (!$rst) {
						return false;
					}
				}
			}
		}

		if ($fromVer != '0.0.0') {
			$db->update('{module}')->set(['version' => $toVer])->where(['name' => $this->namespace])->exec();
		}

		return true;
	}
public final function upgrade($db, $toVer, $fromVer = '0.0.0') {
		if ($fromVer !== '0.0.0' && !$db->select('id')->from('{module}')->where(['name' => $this->namespace])->exist('id')) {
			return false;
		}
		$prev = $fromVer;
		foreach ($this->getVersionList() as $ver => $chang) {
			$func = 'upgradeTo' . str_replace('.', '_', $ver);
			if (version_compare($ver, $toVer, '<=') && version_compare($ver, $fromVer, '>')) {
				$sqls = $this->getSchemaSQLs($ver, $prev);
				$prev = $ver;
				if ($sqls) {
					$sr = ['{prefix}', '{encoding}'];
					$rp = [$db->getDialect()->getTablePrefix(), $db->getDialect()->getCharset()];
					foreach ($sqls as $_sql) {
						if (!$_sql) {
							continue;
						}
						$_sql = (array)$_sql;
						foreach ($_sql as $sql) {
							$sql = str_replace($sr, $rp, $sql);
							$rst = $db->exec($sql);
							if (!$rst) {
								throw_exception($db->error);
							}
						}
					}
				}
				if ($func && method_exists($this, $func)) {
					$rst = $this->{$func}($db);
					if (!$rst) {
						return false;
					}
				}
			}
		}

		if ($fromVer != '0.0.0') {
			$db->update('{module}')->set(['version' => $toVer])->where(['name' => $this->namespace])->exec();
		}

		return true;
	}
@param DatabaseConnection $db
@param string             $toVer
@param string             $fromVer

@return bool
@throws