From 1ff8e29eed0ace40c43a98b78833d6d06f4a000b Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sat, 6 Apr 2024 19:52:36 +0200 Subject: [PATCH] Cleanup README.md, legacy MadelineProto table migration coverage --- .gitignore | 1 + README.md | 2 +- src/Internal/Driver/MysqlArray.php | 6 ++++++ src/Internal/Driver/PostgresArray.php | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index fab00e9..a8db918 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.vscode /infection/ a.php .phpunit.cache diff --git a/README.md b/README.md index dc07279..79bebea 100644 --- a/README.md +++ b/README.md @@ -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 and Alexander Pankratov . +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. diff --git a/src/Internal/Driver/MysqlArray.php b/src/Internal/Driver/MysqlArray.php index f58252e..135b387 100644 --- a/src/Internal/Driver/MysqlArray.php +++ b/src/Internal/Driver/MysqlArray.php @@ -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}`"); diff --git a/src/Internal/Driver/PostgresArray.php b/src/Internal/Driver/PostgresArray.php index 645ca28..1dd8131 100644 --- a/src/Internal/Driver/PostgresArray.php +++ b/src/Internal/Driver/PostgresArray.php @@ -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 } }