From 7edd22e6fb497fa02e3202379a590429b66976af Mon Sep 17 00:00:00 2001 From: dmitry krokhin Date: Wed, 8 May 2024 14:11:25 +0300 Subject: [PATCH] space migration consistency check --- src/Space.php | 3 +++ tests/MapperTest.php | 1 + 2 files changed, 4 insertions(+) diff --git a/src/Space.php b/src/Space.php index 66ad5b6..4cb7beb 100644 --- a/src/Space.php +++ b/src/Space.php @@ -303,6 +303,9 @@ public function migrate() $source = $this->constructor ? $constructor->getParameters() : $reflection->getProperties(); foreach ($source as $property) { + if (in_array($property->getName(), $this->fields)) { + continue; + } $tarantoolType = match ((string) $property->getType()) { 'bool' => 'boolean', 'float' => 'number', diff --git a/tests/MapperTest.php b/tests/MapperTest.php index a82ba3c..9726852 100644 --- a/tests/MapperTest.php +++ b/tests/MapperTest.php @@ -140,6 +140,7 @@ public function testSpaces() $space = $mapper->createSpace($name); $space->setClass($type); $space->migrate(); + $space->migrate(); $this->assertSame($space, $mapper->createSpace($name, ['if_not_exists' => true])); $this->assertSame($space, $mapper->getSpace($space->getId()));