Browse Source

Corrige adicionar num_proposicao faltando ao legado

Fix #1463
pull/1490/head
Marcio Mazza 7 years ago
parent
commit
51e1944f4a
  1. 9
      sapl/legacy/scripts/fix_tables.sql
  2. 20
      sapl/materia/migrations/0017_auto_20170918_1257.py
  3. 2
      sapl/materia/models.py

9
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;

20
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'),
),
]

2
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(

Loading…
Cancel
Save