Commit 9380e8b6 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Possibilité de mettre à jour la BDD sans traiter les données ni lancer les migrations

parent 74fc46ca
Loading
Loading
Loading
Loading
Loading
+7 −2
Changes for src/Bdd.php: 7 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -850,19 +850,20 @@ class Bdd



    public function update(): self
    public function update(bool $withData = true, bool $withMigration=true): self
    {
        $this->logTitle('Mise à jour de la base de données');

        $ddl     = $this->getRefDdl();
        $filters = $this->getFiltersForUpdateBdd($ddl);

        if ($withMigration) {
            // Initialisation et lancement de la pré-migration
            $migrationManager = $this->migration();

            $migrationManager->init($ddl, $filters);
            $migrationManager->run(MigrationManager::ACTION_BEFORE);

        }

        try {
            $this->alter($ddl, $filters, true);
@@ -880,11 +881,15 @@ class Bdd


        // Mise à jour des données
        if ($withData) {
            $this->updateData();
        }


        if ($withMigration) {
            // Post-migration
            $migrationManager->run(MigrationManager::ACTION_AFTER);
        }

        return $this;
    }