Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't throw on deleteAttribute if column doesn't exist #470

Merged
merged 7 commits into from
Nov 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tests/e2e/Adapter/MirrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
class MirrorTest extends Base
{
protected static ?Mirror $database = null;
protected static ?PDO $pdo = null;
PineappleIOnic marked this conversation as resolved.
Show resolved Hide resolved
protected static Database $source;
protected static Database $destination;

Expand Down Expand Up @@ -95,6 +96,7 @@ protected static function getDatabase(bool $fresh = false): Mirror

$database->create();

self::$pdo = $pdo;
return self::$database = $database;
}

Expand Down Expand Up @@ -312,4 +314,14 @@ public function testDeleteMirroredDocument(): void
$this->assertTrue($database->getSource()->getDocument('testDeleteMirroredDocument', $document->getId())->isEmpty());
$this->assertTrue($database->getDestination()->getDocument('testDeleteMirroredDocument', $document->getId())->isEmpty());
}

protected static function deleteColumn(string $collection, string $column): bool
{
$sqlTable = "`" . self::getDatabase()->getDatabase() . "`.`" . self::getDatabase()->getNamespace() . "_" . $collection . "`";
PineappleIOnic marked this conversation as resolved.
Show resolved Hide resolved
$sql = "ALTER TABLE {$sqlTable} DROP COLUMN `{$column}`";

self::$pdo->exec($sql);

return true;
}
}
Loading