Skip to content

Commit

Permalink
space migration consistency check
Browse files Browse the repository at this point in the history
  • Loading branch information
nekufa committed May 8, 2024
1 parent 1d6f791 commit 7edd22e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Space.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions tests/MapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down

0 comments on commit 7edd22e

Please sign in to comment.