Commit 4e402ea9 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Merge branch 'master' of https://git.unicaen.fr/open-source/OSE

parents 3e017e3f 9ea77aee
Loading
Loading
Loading
Loading
+2 −1
Changes for admin/migration/MigrationDossier.php: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -23,8 +23,8 @@ class MigrationDossier extends AbstractMigration

    public function utile(): bool
    {
        return true;
        $bdd = $this->manager->getBdd();
        if ($this->manager->hasOldTable('INTERVENANT_DOSSIER')) {
            $tableIntervenantDossier = $bdd->getTable('INTERVENANT_DOSSIER');
            //Si table intervenant_dossier n'est pas vide, c'est que la migration
            //a déjà eu lieu donc on ne lance pas la migration
@@ -32,6 +32,7 @@ class MigrationDossier extends AbstractMigration
            if ($intervenantDossier) {
                return false;
            }
        }

        return true;
    }
+58
Changes for admin/migration/MigrationPays.php: 58 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php





class MigrationPays extends AbstractMigration
{
    protected $contexte = self::CONTEXTE_ALL;



    public function description(): string
    {
        return "Migration de la table PAYS";
    }



    public function utile(): bool
    {
        return $this->manager->hasOldColumn('PAYS', 'LIBELLE_COURT')
            && $this->manager->hasOldColumn('PAYS', 'LIBELLE_LONG')
            && $this->manager->hasNewColumn('PAYS', 'LIBELLE');
    }



    public function action(string $contexte)
    {
        if ($contexte == self::CONTEXTE_PRE) {
            $this->before();
        } else {
            $this->after();
        }
    }



    protected function before()
    {
        $bdd     = $this->manager->getBdd();
        $console = $this->manager->getOseAdmin()->getConsole();
        $console->println("Renommage de la colonne LIBELLE_LONG en LIBELLE dans la table PAYS");
        $sql = "RENAME COLUMN PAYS.LIBELLE_LONG TO LIBELLE";
        $console->println($sql);
        $bdd->exec($sql);
        $console->println("Renommage de la colonne effectué");
    }



    protected function after()
    {

    }
}