Sistema de Apoio ao Processo Legislativo
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.
 
 
 
 
 

67 lines
3.0 KiB

# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-17 18:31
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('parlamentares', '0028_auto_20190515_1744'),
]
operations = [
migrations.RunSQL("""
INSERT INTO django_content_type (app_label, model)
SELECT 'parlamentares', 'bloco'
WHERE NOT EXISTS (SELECT id
FROM django_content_type
WHERE app_label = 'parlamentares' AND model = 'bloco');
"""),
migrations.RunSQL("""
INSERT INTO base_tipoautor (descricao, content_type_id)
SELECT 'Bloco Parlamentar', (SELECT id
FROM django_content_type
WHERE app_label = 'parlamentares' AND model = 'bloco')
WHERE NOT EXISTS (SELECT id
FROM base_tipoautor
WHERE content_type_id = (SELECT id
FROM django_content_type
WHERE app_label = 'parlamentares' AND model = 'bloco'));
"""),
migrations.RunSQL("""
UPDATE auth_permission
SET content_type_id = (SELECT id
FROM django_content_type
WHERE app_label = 'parlamentares' AND model = 'bloco')
WHERE content_type_id = (SELECT id
FROM django_content_type
WHERE app_label = 'sessao' AND model = 'bloco')
AND NOT EXISTS (SELECT id
FROM django_content_type
WHERE app_label = 'parlamentares' AND model = 'bloco');
"""),
migrations.RunSQL("""
UPDATE base_autor
SET tipo_id = (SELECT id
FROM base_tipoautor
WHERE content_type_id = (SELECT id
FROM django_content_type
WHERE app_label = 'parlamentares' AND model = 'bloco')),
content_type_id = (SELECT id
FROM django_content_type
WHERE app_label = 'parlamentares' AND model = 'bloco')
WHERE tipo_id = (SELECT id
FROM base_tipoautor
WHERE content_type_id = (SELECT id
FROM django_content_type
WHERE app_label = 'sessao' AND model = 'bloco'));
"""),
migrations.RunSQL("""
DELETE FROM base_tipoautor
WHERE content_type_id = (SELECT id
FROM django_content_type
WHERE app_label = 'sessao' AND model = 'bloco');
"""),
]