mirror of
https://github.com/danog/MadelineProto.git
synced 2025-01-22 12:51:21 +01:00
Renaming
This commit is contained in:
parent
cbae5b35fd
commit
fef3bf932a
@ -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());
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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";
|
||||
|
Loading…
x
Reference in New Issue
Block a user