Cleanup README.md, legacy MadelineProto table migration coverage

This commit is contained in:
Daniil Gentili 2024-04-06 19:52:36 +02:00
parent 3180939131
commit 1ff8e29eed
4 changed files with 10 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.vscode
/infection/
a.php
.phpunit.cache

View File

@ -5,7 +5,7 @@
[![Psalm level 1](https://shepherd.dev/github/danog/AsyncOrm/level.svg)](https://shepherd.dev/github/danog/AsyncOrm)
![License](https://img.shields.io/github/license/danog/AsyncOrm)
Async ORM based on AMPHP v3 and fibers, created by Daniil Gentili <daniil@daniil.it> and Alexander Pankratov <alexander@i-c-a.su>.
Async ORM based on AMPHP v3 and fibers, created by Daniil Gentili (https://daniil.it) and Alexander Pankratov (alexander@i-c-a.su).
Supports MySQL, Redis, Postgres.

View File

@ -168,8 +168,10 @@ final class MysqlArray extends SqlArray
} elseif ($key === 'value') {
$expected = $valueType;
} else {
// @codeCoverageIgnoreStart
$db->query("ALTER TABLE `{$config->table}` DROP `$key`");
continue;
// @codeCoverageIgnoreEnd
}
if ($expected !== $type || $null !== 'NO') {
$db->query("ALTER TABLE `{$config->table}` MODIFY `$key` $expected NOT NULL");
@ -182,11 +184,15 @@ final class MysqlArray extends SqlArray
->execute([$database, $config->table])
->fetchRow();
if ($result === null) {
// @codeCoverageIgnoreStart
throw new AssertionError("Result cannot be null!");
// @codeCoverageIgnoreEnd
}
$result = $result['data_free'] ?? $result['DATA_FREE'];
if (!\is_int($result)) {
// @codeCoverageIgnoreStart
throw new AssertionError("data_free must be an integer!");
// @codeCoverageIgnoreEnd
}
if (($result >> 20) >= $settings->optimizeIfWastedMb) {
$db->query("OPTIMIZE TABLE `{$config->table}`");

View File

@ -142,7 +142,9 @@ class PostgresArray extends SqlArray
$connection->query("ALTER TABLE \"bytea_{$config->table}\" ALTER COLUMN \"$key\" TYPE $expected");
}
if ($null !== 'NO') {
// @codeCoverageIgnoreStart
$connection->query("ALTER TABLE \"bytea_{$config->table}\" ALTER COLUMN \"$key\" SET NOT NULL");
// @codeCoverageIgnoreEnd
}
}