src/Inspector.php
/**
     * Prepares a blueprint for the upcoming update.
     * @param StructureInterface $newStructure
     * @param bool $onlyShow
     * @param array<string> $migrationsToSkip
     * @param array<string> $migrationPaths
     * @param string|null $schema
     * @param string|null $engineVersion
     * @return BlueprintInterface
     * @throws InvalidConfigException
     * @throws ErrorException
     * @throws NotSupportedException
     */
Prepares a blueprint for the upcoming update.
Prepares a blueprint for the upcoming update .
public function prepareBlueprint(
        StructureInterface $newStructure,
        bool $onlyShow,
        array $migrationsToSkip,
        array $migrationPaths,
        ?string $schema,
        ?string $engineVersion
    ): BlueprintInterface {
        $this->currentTable = $newStructure->getName();
        $this->appliedChanges = [];
        $history = $this->historyManager->fetchHistory();
        $blueprint = new Blueprint();
        $blueprint->setTableName($this->currentTable);
        if (count($history)) {
            foreach ($history as $migration => $time) {
                $migration = trim($migration, '\\');
                if (in_array($migration, $migrationsToSkip, true)) {
                    continue;
                }
                $this->extractor->extract($migration, $migrationPaths);
                if ($this->gatherChanges($this->extractor->getChanges()) === false) {
                    break;
                }
            }
            $appliedChanges = count($this->appliedChanges);
            if ($appliedChanges) {
                $this->comparator->compare(
                    $newStructure,
                    $this->structureBuilder->build(array_reverse($this->appliedChanges), $schema, $engineVersion),
                    $blueprint,
                    $onlyShow,
                    $schema,
                    $engineVersion
                );
            } else {
                $blueprint->startFromScratch();
            }
        } else {
            $blueprint->startFromScratch();
        }
        return $blueprint;
    }
public function prepareBlueprint ( StructureInterface $ newStructure , bool $ onlyShow , array $ migrationsToSkip , array $ migrationPaths , ? string $ schema , ? string $ engineVersion ) : BlueprintInterface { $ this -> currentTable = $ newStructure -> getName ( ) ; $ this -> appliedChanges = [ ] ; $ history = $ this -> historyManager -> fetchHistory ( ) ; $ blueprint = new Blueprint ( ) ; $ blueprint -> setTableName ( $ this -> currentTable ) ; if ( count ( $ history ) ) { foreach ( $ history as $ migration => $ time ) { $ migration = trim ( $ migration , '\\' ) ; if ( in_array ( $ migration , $ migrationsToSkip , true ) ) { continue ; } $ this -> extractor -> extract ( $ migration , $ migrationPaths ) ; if ( $ this -> gatherChanges ( $ this -> extractor -> getChanges ( ) ) === false ) { break ; } } $ appliedChanges = count ( $ this -> appliedChanges ) ; if ( $ appliedChanges ) { $ this -> comparator -> compare ( $ newStructure , $ this -> structureBuilder -> build ( array_reverse ( $ this -> appliedChanges ) , $ schema , $ engineVersion ) , $ blueprint , $ onlyShow , $ schema , $ engineVersion ) ; } else { $ blueprint -> startFromScratch ( ) ; } } else { $ blueprint -> startFromScratch ( ) ; } return $ blueprint ; }
Prepares a blueprint for the upcoming update.
Prepares a blueprint for the upcoming update .
/** @var int $appliedChanges */