1
0
mirror of https://github.com/danog/MadelineProto.git synced 2025-01-22 12:51:21 +01:00
This commit is contained in:
Daniil Gentili 2023-05-02 19:14:03 +02:00
parent cbae5b35fd
commit fef3bf932a
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
4 changed files with 7 additions and 8 deletions

View File

@ -51,7 +51,7 @@ abstract class DriverArray implements DbArray, IteratorAggregate
/**
* Rename table.
*/
abstract protected function renameTable(string $from, string $to): void;
abstract protected function moveDataFromTableToTable(string $from, string $to): void;
/**
* Get the value of table.
@ -125,9 +125,8 @@ abstract class DriverArray implements DbArray, IteratorAggregate
}
/**
* Rename table of old database, if the new one is not a temporary table name.
*
* Otherwise, simply change name of table in new database to match old table name.
* If the new db has a temporary table name, change its table name to match the old table name.
* Otherwise rename table of old database.
*
* @param self $new New db
* @param DbArray|array|null $old Old db
@ -138,7 +137,7 @@ abstract class DriverArray implements DbArray, IteratorAggregate
if ($old->getTable() !== $new->getTable() &&
!\str_starts_with($new->getTable(), 'tmp')
) {
$new->renameTable($old->getTable(), $new->getTable());
$new->moveDataFromTableToTable($old->getTable(), $new->getTable());
} else {
$new->setTable($old->getTable());
}

View File

@ -103,7 +103,7 @@ class MysqlArray extends SqlArray
");
}
protected function renameTable(string $from, string $to): void
protected function moveDataFromTableToTable(string $from, string $to): void
{
Logger::log("Moving data from {$from} to {$to}", Logger::WARNING);

View File

@ -118,7 +118,7 @@ class PostgresArray extends SqlArray
");
}
protected function renameTable(string $from, string $to): void
protected function moveDataFromTableToTable(string $from, string $to): void
{
Logger::log("Moving data from {$from} to {$to}", Logger::WARNING);

View File

@ -34,7 +34,7 @@ class RedisArray extends DriverArray
{
}
protected function renameTable(string $from, string $to): void
protected function moveDataFromTableToTable(string $from, string $to): void
{
Logger::log("Moving data from {$from} to {$to}", Logger::WARNING);
$from = "va:$from";