Commit 0f6bbbb7 authored by Thibaut Vallee's avatar Thibaut Vallee
Browse files

merge avec realese_6.0.3

parents b0cd79e8 c0e7282e
Loading
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -7,9 +7,15 @@ Changelog
- [FIX] Remplacement de classes Doctrine obsolètes dans SourceListener
- [FIX] DatabaseService::populateDestinationTableFromSource() : beginTransaction() doit être dans le try-catch.
- [FIX] AbstractColumnValueFilter::setParams() : les paramètres spécifiés s'ajoutent aux existants et ne les remplacent plus.
- Dans la table SOURCE, un nouveau flag indique si dans le cadre d'une synchro l'opération 'delete' est interdite. L'interdire est utile lorsque les données sources sont obtenues de façon incrémentale au fil du temps (et non pas de façon exhaustive en une seule fois).
- [FIX] Vue du différentiel d'une synchro : suppression du warning PHP 'Undefined array key'. 
- [FIX] Vue du différentiel d'une synchro : prise en compte du paramètre de config 'source_code_column'.
- [FIX] Correction du SQL générant V_DIFF_* pour le cas d'une synchro depuis une source non-importable
- Synchro : possibilité de spécifier dans la config les seules opérations autorisées par une synchro.
  Exemple : ne pas autoriser le 'delete' est utile lorsque les données sources sont obtenues de façon incrémentale
  au fil du temps, et non pas de façon exhaustive en une seule fois.
- Suppression de 2 lignes intruses dans la config
- DatabaseService::truncateDestinationTable() : on vérifie désormais que les données contiennent un source_id, sinon le vidage partiel est inopérant.
- Préparation de la suppression du paramètre de config 'intermediate_table_auto_drop'

6.0.2
-----
+1 −4
Original line number Diff line number Diff line
@@ -531,7 +531,6 @@ return [
                    'source_code_column' => 'CODE',
                    
                    'intermediate_table' => 'NOM_QUE_JE_FORCE', // sinon ce sera 'TMP_UTILISATEUR'
                    'intermediate_table_auto_drop' => true, // supprime la table intermédiaire si elle existe déjà

                ],
            ],
@@ -547,7 +546,7 @@ php public/index.php run synchro --name "SYNCHRO_BDD_EXTERNE"

Une synchronisation de données à partir d'une autre base de données fait en réalité appel successivement au mécanisme 
d'import et au mécanisme de synchronisation (voir [Fonctionnement](#fonctionnement)) ; d'où la présence
des paramètres facultatifs `intermediate_table` et `intermediate_table_auto_drop`.
des paramètres facultatifs `intermediate_table`.

Fonctionne également en spécifiant une `'table'` au lieu d'un `'select'` dans la source.

@@ -573,8 +572,6 @@ return [
                    'table'              => 'REGION',
                    'connection'         => 'orm_A',
                    'source_code_column' => 'CODE',

                    'intermediate_table_auto_drop' => true,
                ],
            ],
        ],
+6 −5
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@

namespace Application;

use UnicaenDbImport\Domain\Operation;
use UnicaenDbImport\Entity\Db\Source;

return [
@@ -181,6 +182,11 @@ return [
                // Nom unique de la synchro.
                'name' => 'SYNCHRONISATION DES DONNÉES MES_PAYS_TEMPORAIRES VERS MES_PAYS',

                // Seules opérations autorisées par cette synchro.
                // Exemple : ne pas autoriser le 'delete' est utile lorsque les données sources sont obtenues de façon incrémentale (i.e. partielle)
                // au fil du temps, et non pas de façon exhaustive en une seule fois.
                'operations' => Operation::OPERATIONS,

                // Configuration de la source de données à synchroniser :
                'source' => [

@@ -232,11 +238,6 @@ return [
                    // En l'absence de ce forçage, le nom de la table intermédiaire sera celui de la table destination
                    // préfixé par "tmp_".
                    'intermediate_table' => 'tmp_pays',

                    // Suppression automatique des éventuelles tables intermédiaires "tmp_" au début de l'import.
                    // Si la suppression automatique est désactivée, l'existence d'une table intermédiaire au démarrage
                    // d'un import fera échouer l'import.
                    'intermediate_table_auto_drop' => true,
                ],
            ],
        ],
+3 −2
Original line number Diff line number Diff line
@@ -305,11 +305,12 @@ abstract class CodeGenerator implements CodeGeneratorInterface
    /**
     * @param SourceInterface $source
     * @param DestinationInterface $destination
     * @param array $operations
     * @param string|null $intermediateTable
     * @return string
     * @throws \Doctrine\DBAL\Exception
     */
    public function generateSQLForDiffViewCreation(SourceInterface $source, DestinationInterface $destination, string $intermediateTable = null): string
    public function generateSQLForDiffViewCreation(SourceInterface $source, DestinationInterface $destination, array $operations, string $intermediateTable = null): string
    {
        $destinationTable = $destination->getTable();
        $sourceCodeColumn = $source->getSourceCodeColumn();
@@ -317,7 +318,7 @@ abstract class CodeGenerator implements CodeGeneratorInterface

        $diffSourceTableName = $intermediateTable ?: $source->getTable();

        return $this->tableHelper->generateSQLForDiffViewCreation($diffSourceTableName, $destinationTable, $sourceCodeColumn, $columns);
        return $this->tableHelper->generateSQLForDiffViewCreation($operations, $diffSourceTableName, $destinationTable, $sourceCodeColumn, $columns);
    }

    /**
+8 −1
Original line number Diff line number Diff line
@@ -66,6 +66,12 @@ interface CodeGeneratorInterface
     */
    public function generateSQLForSelectFromSource(SourceInterface $source): string;

    /**
     * @param string $sourceTableName
     * @return string
     */
    public function generateSQLForSelectSourceTableColumnsInformation(string $sourceTableName): string;

    /**
     * @param SourceInterface $source
     * @param DestinationInterface $destination
@@ -109,11 +115,12 @@ interface CodeGeneratorInterface
    /**
     * @param SourceInterface $source
     * @param DestinationInterface $destination
     * @param array $operations
     * @param string $intermediateTable
     * @return string
     * @throws \Doctrine\DBAL\Exception
     */
    public function generateSQLForDiffViewCreation(SourceInterface $source, DestinationInterface $destination, string $intermediateTable): string;
    public function generateSQLForDiffViewCreation(SourceInterface $source, DestinationInterface $destination, array $operations, string $intermediateTable): string;

    /**
     * @param SourceInterface $source
Loading