Signed-off-by: Joas Schilling <coding@schilljs.com>tags/v13.0.0beta1
@@ -51,26 +51,31 @@ class <classname> extends SimpleMigrationStep { | |||
/** | |||
* @param IOutput $output | |||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema` | |||
* @param array $options | |||
* @since 13.0.0 | |||
*/ | |||
public function preSchemaChange(IOutput $output) { | |||
public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { | |||
} | |||
/** | |||
* @param \Closure $schema The `\Closure` returns a `Schema` | |||
* @param IOutput $output | |||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema` | |||
* @param array $options | |||
* @return null|Schema | |||
* @since 13.0.0 | |||
*/ | |||
public function changeSchema(\Closure $schema, array $options) { | |||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { | |||
return null; | |||
} | |||
/** | |||
* @param IOutput $output | |||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema` | |||
* @param array $options | |||
* @since 13.0.0 | |||
*/ | |||
public function postSchemaChange(IOutput $output) { | |||
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { | |||
} | |||
} | |||
'; |
@@ -390,9 +390,11 @@ class MigrationService { | |||
throw new \InvalidArgumentException('Not a valid migration'); | |||
} | |||
$instance->preSchemaChange($this->output); | |||
$instance->preSchemaChange($this->output, function() { | |||
return $this->connection->createSchema(); | |||
}, ['tablePrefix' => $this->connection->getPrefix()]); | |||
$toSchema = $instance->changeSchema(function() { | |||
$toSchema = $instance->changeSchema($this->output, function() { | |||
return $this->connection->createSchema(); | |||
}, ['tablePrefix' => $this->connection->getPrefix()]); | |||
@@ -400,7 +402,9 @@ class MigrationService { | |||
$this->connection->migrateToSchema($toSchema); | |||
} | |||
$instance->postSchemaChange($this->output); | |||
$instance->postSchemaChange($this->output, function() { | |||
return $this->connection->createSchema(); | |||
}, ['tablePrefix' => $this->connection->getPrefix()]); | |||
$this->markAsExecuted($version); | |||
} |
@@ -30,21 +30,26 @@ interface IMigrationStep { | |||
/** | |||
* @param IOutput $output | |||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema` | |||
* @param array $options | |||
* @since 13.0.0 | |||
*/ | |||
public function preSchemaChange(IOutput $output); | |||
public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options); | |||
/** | |||
* @param \Closure $schema The `\Closure` returns a `Schema` | |||
* @param IOutput $output | |||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema` | |||
* @param array $options | |||
* @return null|Schema | |||
* @since 13.0.0 | |||
*/ | |||
public function changeSchema(\Closure $schema, array $options); | |||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options); | |||
/** | |||
* @param IOutput $output | |||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema` | |||
* @param array $options | |||
* @since 13.0.0 | |||
*/ | |||
public function postSchemaChange(IOutput $output); | |||
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options); | |||
} |
@@ -30,25 +30,30 @@ abstract class SimpleMigrationStep implements IMigrationStep { | |||
/** | |||
* @param IOutput $output | |||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema` | |||
* @param array $options | |||
* @since 13.0.0 | |||
*/ | |||
public function preSchemaChange(IOutput $output) { | |||
public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { | |||
} | |||
/** | |||
* @param \Closure $schema | |||
* @param IOutput $output | |||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema` | |||
* @param array $options | |||
* @return null|Schema | |||
* @since 13.0.0 | |||
*/ | |||
public function changeSchema(\Closure $schema, array $options) { | |||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { | |||
return null; | |||
} | |||
/** | |||
* @param IOutput $output | |||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema` | |||
* @param array $options | |||
* @since 13.0.0 | |||
*/ | |||
public function postSchemaChange(IOutput $output) { | |||
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { | |||
} | |||
} |