From ce59f543b472bbb5775f23d63f5fb16ea1d3e3f4 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Wed, 14 Mar 2018 17:48:30 -0300 Subject: [PATCH] =?UTF-8?q?Adapata=20migra=C3=A7=C3=A3o=20a=20doc=20acesso?= =?UTF-8?q?rio=20repetido?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/legacy/migracao_dados.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sapl/legacy/migracao_dados.py b/sapl/legacy/migracao_dados.py index 51c194bf4..2ac75c4ef 100644 --- a/sapl/legacy/migracao_dados.py +++ b/sapl/legacy/migracao_dados.py @@ -57,12 +57,17 @@ unique_constraints = [] one_to_one_constraints = [] primeira_vez = [] -# apps do not overlap -name_sets = [set(m.__name__ for m in ac.get_models()) for ac in appconfs] -for s1 in name_sets: - for s2 in name_sets: - if s1 is not s2: - assert not s1.intersection(s2) +# apps quase não têm interseção +name_sets = [(ac.label, set(m.__name__ for m in ac.get_models())) + for ac in appconfs] +for a1, s1 in name_sets: + for a2, s2 in name_sets: + if a1 is not a2: + # existe uma interseção de nomes entre comissoes e materia + if {a1, a2} == {'comissoes', 'materia'}: + assert s1.intersection(s2) == {'DocumentoAcessorio'} + else: + assert not s1.intersection(s2) legacy_app = apps.get_app_config('legacy')