Skip to content

Commit 5d2c793

Browse files
committed
bootstrap wrap migrations in once
1 parent 8f7e9a6 commit 5d2c793

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Install using composer.
1010
```json
1111
{
1212
"require": {
13-
"tarantool/mapper": "2.2.0"
13+
"tarantool/mapper": "^2.2.2"
1414
}
1515
}
1616
```

src/Bootstrap.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ public function register($instance)
1919

2020
public function migrate()
2121
{
22+
$schema = $this->mapper->getSchema();
2223
foreach($this->migrations as $migration) {
2324
if(!is_object($migration)) {
2425
$migration = new $migration;
2526
}
26-
$migration->migrate($this->mapper);
27+
$schema->once(get_class($migration), function() use ($migration) {
28+
$migration->migrate($this->mapper);
29+
});
2730
}
2831
}
2932
}

0 commit comments

Comments
 (0)