public function alter(Schema $schema)
{
$currentSchema = $this->connection->getSchemaManager()->createSchema();
$targetSchema = clone $currentSchema;
foreach ($schema->types() as $type) {
$tableName = $this->tableName($schema->name(), $type->name());
if ($targetSchema->hasTable($tableName)) {
$targetSchema->dropTable($tableName);
}
$this->createTable($targetSchema, $schema->name(), $type);
}
$queries = $currentSchema->getMigrateToSql($targetSchema, $this->connection->getDatabasePlatform());
$this->executeQueries($queries);
}