mirror of https://github.com/interlegis/sapl.git
6 changed files with 139 additions and 27 deletions
@ -0,0 +1,41 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Generated by Django 1.11.20 on 2019-05-31 18:38 |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('materia', '0066_auto_20200313_1441'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.RunSQL(""" |
|||
create view materia_protocolomateria as |
|||
select p.id, |
|||
p.numero as numero_protocolo, |
|||
p.ano as ano_protocolo, |
|||
count(*) total, |
|||
array_agg(m.id) as materias |
|||
from materia_materialegislativa m |
|||
left join protocoloadm_protocolo p on (m.ano = p.ano and m.numero_protocolo = p.numero) |
|||
where m.numero_protocolo is not null |
|||
group by p.id |
|||
order by p.numero, p.ano; |
|||
"""), |
|||
migrations.RunSQL(""" |
|||
create view materia_materiaprotocolo as |
|||
select m.id, |
|||
m.id as materia_id, |
|||
m.numero numero_materia, |
|||
m.ano ano_materia, |
|||
m.numero_protocolo, |
|||
m.ano ano_protocolo |
|||
from materia_materialegislativa m |
|||
left join protocoloadm_protocolo p on (m.ano = p.ano and m.numero_protocolo = p.numero) |
|||
where m.numero_protocolo is not null and p.numero is null |
|||
order by m.ano desc , m.numero desc |
|||
"""), |
|||
] |
@ -0,0 +1,44 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Generated by Django 1.11.29 on 2020-04-01 15:18 |
|||
from __future__ import unicode_literals |
|||
|
|||
import django.contrib.postgres.fields |
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('materia', '0067_auto_20200401_1216'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.CreateModel( |
|||
name='MateriaProtocolo', |
|||
fields=[ |
|||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
|||
('numero_materia', models.PositiveIntegerField()), |
|||
('ano_materia', models.PositiveIntegerField()), |
|||
('numero_protocolo', models.PositiveIntegerField()), |
|||
('ano_protocolo', models.PositiveIntegerField()), |
|||
], |
|||
options={ |
|||
'db_table': 'materia_materiaprotocolo', |
|||
'managed': False, |
|||
}, |
|||
), |
|||
migrations.CreateModel( |
|||
name='ProtocoloMateria', |
|||
fields=[ |
|||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
|||
('numero_protocolo', models.PositiveIntegerField()), |
|||
('ano_protocolo', models.PositiveIntegerField()), |
|||
('total', models.PositiveIntegerField()), |
|||
('materias', django.contrib.postgres.fields.ArrayField(base_field=models.PositiveIntegerField(), size=None)), |
|||
], |
|||
options={ |
|||
'db_table': 'materia_protocolomateria', |
|||
'managed': False, |
|||
}, |
|||
), |
|||
] |
Loading…
Reference in new issue