mirror of https://github.com/interlegis/sapl.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.5 KiB
41 lines
1.5 KiB
# -*- 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
|
|
"""),
|
|
]
|
|
|