@@ -62,10 +62,10 @@ |
||
| 62 | 62 | { |
| 63 | 63 | $app = TestApp::init( |
| 64 | 64 | [ |
| 65 | - 'root' => __DIR__ . '/../../..', |
|
| 66 | - 'app' => __DIR__ . '/../../emptyApp', |
|
| 67 | - 'runtime' => sys_get_temp_dir() . '/spiral', |
|
| 68 | - 'cache' => sys_get_temp_dir() . '/spiral', |
|
| 65 | + 'root' => __DIR__.'/../../..', |
|
| 66 | + 'app' => __DIR__.'/../../emptyApp', |
|
| 67 | + 'runtime' => sys_get_temp_dir().'/spiral', |
|
| 68 | + 'cache' => sys_get_temp_dir().'/spiral', |
|
| 69 | 69 | ], |
| 70 | 70 | new Environment(['SAFE_MIGRATIONS' => true]), |
| 71 | 71 | false |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | public function getGenerators(): array |
| 86 | 86 | { |
| 87 | 87 | $result = []; |
| 88 | - foreach ($this->generators as $group) { |
|
| 89 | - foreach ($group as $generator) { |
|
| 90 | - if (is_object($generator) && !$generator instanceof Container\Autowire) { |
|
| 88 | + foreach ($this->generators as $group){ |
|
| 89 | + foreach ($group as $generator){ |
|
| 90 | + if (is_object($generator) && !$generator instanceof Container\Autowire){ |
|
| 91 | 91 | $result[] = $generator; |
| 92 | - } else { |
|
| 92 | + }else{ |
|
| 93 | 93 | $result[] = $this->container->get($generator); |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | protected function schema(MemoryInterface $memory): SchemaInterface |
| 108 | 108 | { |
| 109 | 109 | $schemaCompiler = SchemaCompiler::fromMemory($memory); |
| 110 | - if ($schemaCompiler->isEmpty()) { |
|
| 110 | + if ($schemaCompiler->isEmpty()){ |
|
| 111 | 111 | $schemaCompiler = SchemaCompiler::compile( |
| 112 | 112 | $this->container->get(Registry::class), |
| 113 | 113 | $this->getGenerators() |
@@ -85,11 +85,16 @@ discard block |
||
| 85 | 85 | public function getGenerators(): array |
| 86 | 86 | { |
| 87 | 87 | $result = []; |
| 88 | - foreach ($this->generators as $group) { |
|
| 89 | - foreach ($group as $generator) { |
|
| 90 | - if (is_object($generator) && !$generator instanceof Container\Autowire) { |
|
| 88 | + foreach ($this->generators as $group) |
|
| 89 | + { |
|
| 90 | + foreach ($group as $generator) |
|
| 91 | + { |
|
| 92 | + if (is_object($generator) && !$generator instanceof Container\Autowire) |
|
| 93 | + { |
|
| 91 | 94 | $result[] = $generator; |
| 92 | - } else { |
|
| 95 | + } |
|
| 96 | + else |
|
| 97 | + { |
|
| 93 | 98 | $result[] = $this->container->get($generator); |
| 94 | 99 | } |
| 95 | 100 | } |
@@ -107,7 +112,8 @@ discard block |
||
| 107 | 112 | protected function schema(MemoryInterface $memory): SchemaInterface |
| 108 | 113 | { |
| 109 | 114 | $schemaCompiler = SchemaCompiler::fromMemory($memory); |
| 110 | - if ($schemaCompiler->isEmpty()) { |
|
| 115 | + if ($schemaCompiler->isEmpty()) |
|
| 116 | + { |
|
| 111 | 117 | $schemaCompiler = SchemaCompiler::compile( |
| 112 | 118 | $this->container->get(Registry::class), |
| 113 | 119 | $this->getGenerators() |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | ); |
| 45 | 45 | $schemaCompiler->toMemory($memory); |
| 46 | 46 | |
| 47 | - if ($show->hasChanges()) { |
|
| 47 | + if ($show->hasChanges()){ |
|
| 48 | 48 | $this->writeln("\n<info>ORM Schema has been synchronized</info>"); |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -44,7 +44,8 @@ |
||
| 44 | 44 | ); |
| 45 | 45 | $schemaCompiler->toMemory($memory); |
| 46 | 46 | |
| 47 | - if ($show->hasChanges()) { |
|
| 47 | + if ($show->hasChanges()) |
|
| 48 | + { |
|
| 48 | 49 | $this->writeln("\n<info>ORM Schema has been synchronized</info>"); |
| 49 | 50 | } |
| 50 | 51 | } |
@@ -50,12 +50,12 @@ discard block |
||
| 50 | 50 | Migrator $migrator, |
| 51 | 51 | Console $console |
| 52 | 52 | ): void { |
| 53 | - if (!$this->verifyConfigured()) { |
|
| 53 | + if (!$this->verifyConfigured()){ |
|
| 54 | 54 | return; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - foreach ($migrator->getMigrations() as $migration) { |
|
| 58 | - if ($migration->getState()->getStatus() !== State::STATUS_EXECUTED) { |
|
| 57 | + foreach ($migrator->getMigrations() as $migration){ |
|
| 58 | + if ($migration->getState()->getStatus() !== State::STATUS_EXECUTED){ |
|
| 59 | 59 | $this->writeln('<fg=red>Outstanding migrations found, run `migrate` first.</fg=red>'); |
| 60 | 60 | return; |
| 61 | 61 | } |
@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | ); |
| 70 | 70 | $schemaCompiler->toMemory($memory); |
| 71 | 71 | |
| 72 | - if ($show->hasChanges()) { |
|
| 72 | + if ($show->hasChanges()){ |
|
| 73 | 73 | (new Compiler())->compile($registry, [$migrations]); |
| 74 | 74 | |
| 75 | - if ($this->option('run')) { |
|
| 75 | + if ($this->option('run')){ |
|
| 76 | 76 | $console->run('migrate', [], $this->output); |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -50,12 +50,15 @@ discard block |
||
| 50 | 50 | Migrator $migrator, |
| 51 | 51 | Console $console |
| 52 | 52 | ): void { |
| 53 | - if (!$this->verifyConfigured()) { |
|
| 53 | + if (!$this->verifyConfigured()) |
|
| 54 | + { |
|
| 54 | 55 | return; |
| 55 | 56 | } |
| 56 | 57 | |
| 57 | - foreach ($migrator->getMigrations() as $migration) { |
|
| 58 | - if ($migration->getState()->getStatus() !== State::STATUS_EXECUTED) { |
|
| 58 | + foreach ($migrator->getMigrations() as $migration) |
|
| 59 | + { |
|
| 60 | + if ($migration->getState()->getStatus() !== State::STATUS_EXECUTED) |
|
| 61 | + { |
|
| 59 | 62 | $this->writeln('<fg=red>Outstanding migrations found, run `migrate` first.</fg=red>'); |
| 60 | 63 | return; |
| 61 | 64 | } |
@@ -69,10 +72,12 @@ discard block |
||
| 69 | 72 | ); |
| 70 | 73 | $schemaCompiler->toMemory($memory); |
| 71 | 74 | |
| 72 | - if ($show->hasChanges()) { |
|
| 75 | + if ($show->hasChanges()) |
|
| 76 | + { |
|
| 73 | 77 | (new Compiler())->compile($registry, [$migrations]); |
| 74 | 78 | |
| 75 | - if ($this->option('run')) { |
|
| 79 | + if ($this->option('run')) |
|
| 80 | + { |
|
| 76 | 81 | $console->run('migrate', [], $this->output); |
| 77 | 82 | } |
| 78 | 83 | } |