Rename a table.

@param string $old The old name of the table.
@param string $new The new name of the table.
328564
private function renameTable($old, $new) {
        $renameSql = 'alter table '.
            $this->prefixTable($old).
            ' rename to '.
            $this->prefixTable($new);
        $this->queryDefine($renameSql);
    }
796533
public function renameTable($oldTableName, $newTableName)
    {
        $table = $this->getTable($oldTableName);
        $table->_setName($newTableName);

        $this->dropTable($oldTableName);
        $this->_addTable($table);

        return $this;
    }
1212862
public function rename($oldName, $newName)
    {
        if (null !== $this->collection->get($newName)) {
            throw new RuntimeException(
                sprintf(
                    'Could not rename toggle %1$s to %2$s, a toggle with name %2$s already exists',
                    $oldName,
                    $newName
                )
            );
        }

        $currentToggle = $this->collection->get($oldName);

        if (null === $currentToggle) {
            throw new RuntimeException(
                sprintf(
                    'Could not rename toggle %1$s to %2$s, toggle with name %1$s does not exists',
                    $oldName,
                    $newName
                )
            );
        }

        $currentToggle->rename($newName);

        if (false === $this->add($currentToggle)) {
            throw new RuntimeException(
                sprintf(
                    'Failed to rename toggle %1$s to %2$s, an error occurred when saving toggle with new name',
                    $oldName,
                    $newName
                )
            );
        }

        return $this->remove($oldName);
    }
914630
public function rename($oldname, $newname)
    {
        $container = $this->getContainerFromContext($newname);
        $oldname = $this->stripScheme($oldname);
        $newname = $this->stripScheme($newname);

        try {
            $container->move($oldname, $newname);
        } catch (NotFoundException $e) {
            trigger_error(
                sprintf('mv: rename %s to %s: No such file or directory', $oldname, $newname),
                E_USER_WARNING
            );

            return false;
        } catch (\RuntimeException $e) {
            trigger_error(
                sprintf('mv: rename %s to %s: Not a directory', $oldname, $newname),
                E_USER_WARNING
            );

            return false;
        }

        return true;
    }
725102
public function rename($oldName, $newName)
	{
		$form = $this->get($oldName);
		$this->delete($oldName);
		$this->add($newName, $form['code'], $form['title']);
	}
777471
public function rename( string $old_name, string $new_name ): Prop
	{
		// check old
		$row = self::getEventItem($old_name);
		if( !$row )
		{
			throw new NotFoundException("Event '{$old_name}' not found");
		}

		$this->permissible($row->module_id, $old_name);

		// is update ?

		$prop = new Prop([
			"action" => "rename",
			"renamed" => false
		]);

		if( $old_name === $new_name )
		{
			return $prop;
		}

		// check new
		if( self::hasName($new_name) )
		{
			throw new \InvalidArgumentException("Duplicate event name '{$new_name}'");
		}

		if( ! $this->isValidModuleName($new_name) )
		{
			throw new \InvalidArgumentException("Invalid event name '{$new_name}' for the " . $this->getModule()->getName() . " module");
		}

		// dispatch event
		$event = new EventRenameDriverEvent($this, $old_name, $new_name);
		$dispatcher = EventManager::dispatcher($event->getName());
		$dispatcher->dispatch($event);

		$prop->set(
			"renamed",
			\DB::
				table("events")
					->whereId($row->id)
					->update(['name' => $new_name]) > 0
		);

		$prop->get("renamed") && $this->addLogDebug(Text::createInstance("The %s event is successfully renamed. New event name is %s", $old_name, $new_name));
		$dispatcher->complete($prop);
		return $prop;
	}
266627
public function renameCheck($oldName, $newName)
    {
        if (!$this->hasCheck($oldName)) {
            throw SchemaException::tableCheckDoesNotExist($this->getName(), $oldName);
        }

        if ($this->hasCheck($newName)) {
            throw SchemaException::tableCheckAlreadyExists($this->getName(), $newName);
        }

        $this->checks[$oldName]->setName($newName);
        $this->checks[$newName] = $this->checks[$oldName];
        unset($this->checks[$oldName]);
    }
481877
public function renameColumn($oldName, $newName)
    {
        if (isset($this[$oldName])) {
            $this[$newName] = $this[$oldName];
        }

        // outside the if () since we want to delete nulled columns
        if ($this->offsetExists($oldName)) {
            unset($this[$oldName]);
        }
    }
747323
public static function mergeGroup($new, $old)
	{
		$new['namespace'] = static::formatUsesPrefix($new, $old);

		$new['prefix'] = static::formatGroupPrefix($new, $old);

		if (isset($new['domain'])) unset($old['domain']);

		$new['where'] = array_merge(array_get($old, 'where', []), array_get($new, 'where', []));

		return array_merge_recursive(array_except($old, array('namespace', 'prefix', 'where')), $new);
	}
272345
protected function formatNamespace(array $new, array $old)
    {
        if (isset($new['namespace']) && isset($old['namespace'])) {
            return trim($old['namespace'], '\\').'\\'.trim($new['namespace'], '\\');
        } elseif (isset($new['namespace'])) {
            return trim($new['namespace'], '\\');
        }

        return Arr::get($old, 'namespace');
    }
1217052
public static function mergeGroup($new, $old)
	{
		$new['namespace'] = static::formatUsesPrefix($new, $old);

		$new['prefix'] = static::formatGroupPrefix($new, $old);

		if (isset($new['domain'])) unset($old['domain']);

		return array_merge_recursive(array_except($old, array('namespace', 'prefix')), $new);
	}
1145082
public static function rename($table, $new_name)
	{
		$table = new Table($table);

		// To indicate that the table needs to be renamed, we will run the
		// "rename" command on the table instance and pass the instance to
		// the execute method as calling a Closure isn't needed.
		$table->rename($new_name);

		return static::execute($table);
	}
320386
public static function merge(array $old, array $new)
    {
        foreach ($new as $key => $value) {
            if (isset($old[$key]) && is_array($old[$key]) && is_array($value)) {
                $old[$key] = self::merge($old[$key], $value);
            } else {
                $old[$key] = $value;
            }
        }

        return $old;
    }
835809
public function renameIndex($oldName, $newName)
    {
        if (!$this->hasIndex($oldName)) {
            throw SchemaException::tableIndexDoesNotExist($this->getName(), $oldName);
        }

        if ($this->hasIndex($newName)) {
            throw SchemaException::tableIndexAlreadyExists($this->getName(), $newName);
        }

        $this->indexes[$oldName]->setName($newName);
        $this->indexes[$newName] = $this->indexes[$oldName];
        unset($this->indexes[$oldName]);
    }
1258377
public function replace($old, $new)
    {
        $this->str = $this->str->replace((string)$old, (string)$new);

        return $this;
    }
1174536
protected function _overwrite(&$old, $new)
    {
        if (!empty($old)) {
            foreach ($old as $key => $var) {
                if (!isset($new[$key])) {
                    unset($old[$key]);
                }
            }
        }
        foreach ($new as $key => $var) {
            $old[$key] = $var;
        }
    }
365893
public static function renameColumn($table, $oldColumn, $newColumn)
    {
        $column = [$oldColumn, $newColumn];

        return static::alterColumn('RENAME', $table, $column);
    }