Commit 08b2ed24 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Correction du problème de détection défectueuse du logging des tables

parent 9effa43c
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -80,8 +80,7 @@ class TableManager extends AbstractManager implements TableManagerInterface
        $q = "SELECT
            ns.nspname                 \"schema\",
            t.relname                  \"name\",
            'N'                        \"temporary\",
            'NO'                       logging,
            t.relpersistence           relpersistence,
            c.column_name              cname,
            c.data_type                \"type\",
            c.character_maximum_length length,
@@ -113,8 +112,8 @@ class TableManager extends AbstractManager implements TableManagerInterface
                $data[$name] = [
                    'schema'      => $paq['schema'],
                    'name'        => $paq['name'],
                    'temporary'   => $paq['temporary'] == 'YES',
                    'logging'     => $paq['logging'] == 'YES',
                    'temporary'   => $paq['relpersistence'] == 't',
                    'logging'     => $paq['relpersistence'] == 'p',
                    'commentaire' => $paq['commentaire'],
                    'sequence'    => $paq['sequence'],
                    'columns'     => [],
@@ -575,9 +574,8 @@ class TableManager extends AbstractManager implements TableManagerInterface
            if ($this->sendEvent()->getReturn('no-exec')) return;

            if ($old['logging'] !== $new['logging']) {
                throw new BddException("Il n'est pas possible actuellement de supprimer le logging d'une table ou de faire l'opération inverse");
                //$log = $new['logging'] ? 'LOGGING' : 'NOLOGGING';
                //$this->addQuery("ALTER TABLE $name $log", 'Modification du logging de la table ' . $name);
                $sql = "ALTER TABLE $name SET ".($new['logging'] ? 'LOGGED' : 'UNLOGGED');
                $this->addQuery($sql, 'Modification du logging de la table ' . $name);
            }

            $newCols = array_diff(array_keys($new['columns']), array_keys($old['columns']));