Commit 34d019d6 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Script migration V15

parent 32bf68e0
Loading
Loading
Loading
Loading
−1
Changes for admin/migration/MigrationDossier.php: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ class MigrationDossier extends AbstractMigration

    public function utile(): bool
    {
        return true;
        $bdd                     = $this->manager->getBdd();
        $tableIntervenantDossier = $bdd->getTable('INTERVENANT_DOSSIER');
        //Si table intervenant_dossier n'est pas vide, c'est que la migration
+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 LIBELLE_LONG TO LIBELLE";
        $console->println($sql);
        $bdd->exec($sql);
        $console->println("Renommage de la colonne effectué");
    }



    protected function after()
    {

    }
}