Browse Source

Limpa caracters nulos de strings

migracao
Marcio Mazza 6 years ago
parent
commit
11ae2717e6
  1. 11
      sapl/legacy/migracao_dados.py

11
sapl/legacy/migracao_dados.py

@ -52,7 +52,6 @@ from sapl.utils import normalize
from .scripts.normaliza_dump_mysql import normaliza_dump_mysql from .scripts.normaliza_dump_mysql import normaliza_dump_mysql
# BASE ###################################################################### # BASE ######################################################################
# apps to be migrated, in app dependency order (very important) # apps to be migrated, in app dependency order (very important)
appconfs = [apps.get_app_config(n) for n in [ appconfs = [apps.get_app_config(n) for n in [
@ -840,9 +839,13 @@ def populate_renamed_fields(new, old):
else: else:
value = getattr(old, old_field_name) value = getattr(old, old_field_name)
if (field_type in ['CharField', 'TextField'] if field_type in ['CharField', 'TextField']:
and value in [None, 'None']): if value in [None, 'None']:
value = '' value = ''
else:
# retira caracters nulos que o postgres não aceita
# quando usamos bulk_create
value = value.strip('\0')
# ajusta tempos segundo timezone # ajusta tempos segundo timezone
# os campos TIMESTAMP do mysql são gravados em UTC # os campos TIMESTAMP do mysql são gravados em UTC

Loading…
Cancel
Save