system/Database/Forge.php
public function renameTable(string $table_name, string $new_table_name)
	{
		if ($table_name === '' || $new_table_name === '')
		{
			throw new \InvalidArgumentException('A table name is required for that operation.');
		}
		elseif ($this->renameTableStr === false)
		{
			if ($this->db->DBDebug)
			{
				throw new DatabaseException('This feature is not available for the database you are using.');
			}

			return false;
		}

		$result = $this->db->query(sprintf($this->renameTableStr,
				$this->db->escapeIdentifiers($this->db->DBPrefix . $table_name),
				$this->db->escapeIdentifiers($this->db->DBPrefix . $new_table_name))
		);

		if ($result && ! empty($this->db->dataCache['table_names']))
		{
			$key = array_search(strtolower($this->db->DBPrefix . $table_name),
				array_map('strtolower', $this->db->dataCache['table_names']), true);
			if ($key !== false)
			{
				$this->db->dataCache['table_names'][$key] = $this->db->DBPrefix . $new_table_name;
			}
		}

		return $result;
	}
public function renameTable(string $table_name, string $new_table_name)
	{
		if ($table_name === '' || $new_table_name === '')
		{
			throw new \InvalidArgumentException('A table name is required for that operation.');
		}
		elseif ($this->renameTableStr === false)
		{
			if ($this->db->DBDebug)
			{
				throw new DatabaseException('This feature is not available for the database you are using.');
			}

			return false;
		}

		$result = $this->db->query(sprintf($this->renameTableStr,
				$this->db->escapeIdentifiers($this->db->DBPrefix . $table_name),
				$this->db->escapeIdentifiers($this->db->DBPrefix . $new_table_name))
		);

		if ($result && ! empty($this->db->dataCache['table_names']))
		{
			$key = array_search(strtolower($this->db->DBPrefix . $table_name),
				array_map('strtolower', $this->db->dataCache['table_names']), true);
			if ($key !== false)
			{
				$this->db->dataCache['table_names'][$key] = $this->db->DBPrefix . $new_table_name;
			}
		}

		return $result;
	}
Rename Table

@param string $table_name     Old table name
@param string $new_table_name New table name

@return mixed
@throws \CodeIgniter\Database\Exceptions\DatabaseException