From 51e1944f4a4b51911f6970215d1cf8268815b8c0 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Mon, 18 Sep 2017 12:58:27 -0300 Subject: [PATCH] Corrige adicionar num_proposicao faltando ao legado Fix #1463 --- sapl/legacy/scripts/fix_tables.sql | 9 ++++++--- .../migrations/0017_auto_20170918_1257.py | 20 +++++++++++++++++++ sapl/materia/models.py | 2 +- 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 sapl/materia/migrations/0017_auto_20170918_1257.py diff --git a/sapl/legacy/scripts/fix_tables.sql b/sapl/legacy/scripts/fix_tables.sql index d8a71bca4..6146d7435 100644 --- a/sapl/legacy/scripts/fix_tables.sql +++ b/sapl/legacy/scripts/fix_tables.sql @@ -17,9 +17,12 @@ CREATE PROCEDURE verifica_campos_proposicao() BEGIN IF NOT EXISTS WHERE table_schema=database() AND TABLE_NAME='proposicao' AND COLUMN_NAME='num_proposicao') THEN -UPDATE proposicao -SET dat_envio = '1800-01-01' -WHERE cast(dat_envio AS char(20)) = '0000-00-00 00:00:00'; + + -- ajusta data zero para poder alterar a tabela + UPDATE proposicao SET dat_envio = '1800-01-01' WHERE dat_envio = 0; + alter table proposicao modify dat_envio datetime; + UPDATE proposicao SET dat_envio = NULL where dat_envio = '1800-01-01'; + ALTER TABLE proposicao ADD COLUMN num_proposicao int(11) NULL AFTER txt_justif_devolucao; END IF; END; diff --git a/sapl/materia/migrations/0017_auto_20170918_1257.py b/sapl/materia/migrations/0017_auto_20170918_1257.py new file mode 100644 index 000000000..d09c5daaa --- /dev/null +++ b/sapl/materia/migrations/0017_auto_20170918_1257.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.13 on 2017-09-18 12:57 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('materia', '0016_merge'), + ] + + operations = [ + migrations.AlterField( + model_name='proposicao', + name='data_envio', + field=models.DateTimeField(null=True, verbose_name='Data de Envio'), + ), + ] diff --git a/sapl/materia/models.py b/sapl/materia/models.py index 28634b225..0ee067dc3 100644 --- a/sapl/materia/models.py +++ b/sapl/materia/models.py @@ -626,7 +626,7 @@ class Proposicao(models.Model): # XXX data_envio was not null, but actual data said otherwise!!! data_envio = models.DateTimeField( - blank=True, null=True, verbose_name=_('Data de Envio')) + blank=False, null=True, verbose_name=_('Data de Envio')) data_recebimento = models.DateTimeField( blank=True, null=True, verbose_name=_('Data de Recebimento')) data_devolucao = models.DateTimeField(