Commit 08f7731f authored by Nicolas Joyard's avatar Nicolas Joyard

Ajout champ _empty pour détection déps manquantes

parent de7905ff
"""ajout_empty
Revision ID: 341bf66902b9
Revises: 511f685c2fc2
Create Date: 2017-04-15 20:19:00.456630
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '341bf66902b9'
down_revision = '511f685c2fc2'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('an_actes', sa.Column('_empty', sa.Boolean(), nullable=True, server_default='True'))
op.add_column('an_acteurs', sa.Column('_empty', sa.Boolean(), nullable=True, server_default='True'))
op.add_column('an_amendements', sa.Column('_empty', sa.Boolean(), nullable=True, server_default='True'))
op.add_column('an_documents', sa.Column('_empty', sa.Boolean(), nullable=True, server_default='True'))
op.add_column('an_dossiers', sa.Column('_empty', sa.Boolean(), nullable=True, server_default='True'))
op.add_column('an_mandats', sa.Column('_empty', sa.Boolean(), nullable=True, server_default='True'))
op.add_column('an_odjpoints', sa.Column('_empty', sa.Boolean(), nullable=True, server_default='True'))
op.add_column('an_organes', sa.Column('_empty', sa.Boolean(), nullable=True, server_default='True'))
op.add_column('an_reunions', sa.Column('_empty', sa.Boolean(), nullable=True, server_default='True'))
op.add_column('an_scrutins', sa.Column('_empty', sa.Boolean(), nullable=True, server_default='True'))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('an_actes', '_empty')
op.drop_column('an_acteurs', '_empty')
op.drop_column('an_amendements', '_empty')
op.drop_column('an_documents', '_empty')
op.drop_column('an_dossiers', '_empty')
op.drop_column('an_mandats', '_empty')
op.drop_column('an_odjpoints', '_empty')
op.drop_column('an_organes', '_empty')
op.drop_column('an_reunions', '_empty')
op.drop_column('an_scrutins', '_empty')
# ### end Alembic commands ###
......@@ -46,6 +46,7 @@ class ImportAmendementsJob(BaseANJob):
si = json['signataires']
data = {
'_empty': False,
'amendement_parent': None,
'article_99': int(json['article99']) > 0,
'cardinal_multiples': int(json['cardinaliteAmdtMultiples']),
......
......@@ -33,6 +33,7 @@ class ImportAMOJob(BaseANJob):
nais = ec['infoNaissance']
data = {
'_empty': False,
'civilite': id['civ'],
'date_deces': None,
'date_naissance': self.parse_date(nais['dateNais']),
......@@ -70,6 +71,7 @@ class ImportAMOJob(BaseANJob):
organe_refs = json['organes']['organeRef']
data = {
'_empty': False,
'acteur': acteur,
'date_debut': self.parse_date(json['dateDebut']),
'date_fin': None,
......@@ -121,6 +123,7 @@ class ImportAMOJob(BaseANJob):
self.current = u'Organe %s' % json['uid']
data = {
'_empty': False,
'abbreviation': json['libelleAbrev'],
'date_debut': None,
'date_fin': None,
......
......@@ -44,6 +44,7 @@ class ImportDossiersJob(BaseANJob):
notice = json['notice']
data = {
'_empty': False,
'acteurs': [],
'date_creation': self.parse_date(chrono['dateCreation']),
'date_depot': self.parse_date(chrono['dateDepot']),
......@@ -150,6 +151,7 @@ class ImportDossiersJob(BaseANJob):
pp = json['procedureParlementaire']
data = {
'_empty': False,
'actes_legislatifs': [],
'acteurs': [],
'legislature': self.save(Legislature, int(json['legislature'])),
......@@ -200,6 +202,7 @@ class ImportDossiersJob(BaseANJob):
self.current = u'Acte %s' % json['uid']
data = {
'_empty': False,
'code': json['codeActe'],
'libelle': json['libelleActe']['nomCanonique'],
'date': None,
......@@ -208,7 +211,6 @@ class ImportDossiersJob(BaseANJob):
'document': None
}
if json.get('date', None):
data['date'] = self.parse_date(json['date'])
elif json.get('dateActe', None):
......
......@@ -26,6 +26,7 @@ class ImportReunionsJob(BaseANJob):
self.current = u'Reunion %s' % json['uid']
data = {
'_empty': False,
'acteurs': [],
'date_cloture': None,
'date_creation': None,
......@@ -158,6 +159,7 @@ class ImportReunionsJob(BaseANJob):
cdv = json['cycleDeVie']
data = {
'_empty': False,
'comite_secret': None,
'date_cloture': self.parse_date(cdv['chrono']['cloture']),
'date_conf_presse': None,
......
......@@ -36,6 +36,7 @@ class ImportScrutinsJob(BaseANJob):
gr = json['ventilationVotes']['organe']['groupes']['groupe']
data = {
'_empty': False,
'date': self.parse_date(json['dateScrutin']),
'demandeur': json['demandeur']['texte'],
'groupes': [self.save_groupe(g) for g in gr],
......
......@@ -14,6 +14,7 @@ class Regime(db.Model):
query_class = SearchableQuery
_last_modified = db.Column(db.DateTime)
id = db.Column(db.Integer, primary_key=True)
nom = db.Column(db.Unicode)
......@@ -28,6 +29,7 @@ class Legislature(db.Model):
__tablename__ = 'an_legislatures'
_last_modified = db.Column(db.DateTime)
id = db.Column(db.Integer, primary_key=True)
date_debut = db.Column(db.Date)
date_fin = db.Column(db.Date)
......@@ -53,6 +55,8 @@ class Organe(db.Model):
query_class = SearchableQuery
_last_modified = db.Column(db.DateTime)
_empty = db.Column(db.Boolean, default=True)
id = db.Column(db.Unicode, primary_key=True)
type = db.Column(db.Unicode)
libelle = db.Column(db.Unicode)
......@@ -85,6 +89,8 @@ class Mandat(db.Model):
query_class = SearchableQuery
_last_modified = db.Column(db.DateTime)
_empty = db.Column(db.Boolean, default=True)
id = db.Column(db.Unicode, primary_key=True)
date_debut = db.Column(db.Date)
......@@ -123,6 +129,8 @@ class Acteur(db.Model):
query_class = SearchableQuery
_last_modified = db.Column(db.DateTime)
_empty = db.Column(db.Boolean, default=True)
id = db.Column(db.Unicode, primary_key=True)
civilite = db.Column(db.Unicode)
......@@ -212,6 +220,8 @@ class Document(db.Model):
query_class = SearchableQuery
_last_modified = db.Column(db.DateTime)
_empty = db.Column(db.Boolean, default=True)
id = db.Column(db.Unicode, primary_key=True)
date_creation = db.Column(db.Date)
......@@ -291,6 +301,8 @@ class Dossier(db.Model):
query_class = SearchableQuery
_last_modified = db.Column(db.DateTime)
_empty = db.Column(db.Boolean, default=True)
id = db.Column(db.Unicode, primary_key=True)
titre = db.Column(db.Unicode)
......@@ -319,6 +331,8 @@ class Acte(db.Model):
query_class = SearchableQuery
_last_modified = db.Column(db.DateTime)
_empty = db.Column(db.Boolean, default=True)
id = db.Column(db.Unicode, primary_key=True)
code = db.Column(db.Unicode)
......@@ -351,6 +365,8 @@ class Amendement(db.Model):
query_class = SearchableQuery
_last_modified = db.Column(db.DateTime)
_empty = db.Column(db.Boolean, default=True)
id = db.Column(db.Unicode, primary_key=True)
numero = db.Column(db.Integer)
......@@ -424,6 +440,8 @@ class Scrutin(db.Model):
query_class = SearchableQuery
_last_modified = db.Column(db.DateTime)
_empty = db.Column(db.Boolean, default=True)
id = db.Column(db.Unicode, primary_key=True)
numero = db.Column(db.Integer)
......@@ -560,6 +578,8 @@ class ODJPoint(db.Model):
query_class = SearchableQuery
_last_modified = db.Column(db.DateTime)
_empty = db.Column(db.Boolean, default=True)
id = db.Column(db.Unicode, primary_key=True)
etat = db.Column(db.Unicode)
......@@ -587,6 +607,8 @@ class Reunion(db.Model):
__tablename__ = 'an_reunions'
_last_modified = db.Column(db.DateTime)
_empty = db.Column(db.Boolean, default=True)
id = db.Column(db.Unicode, primary_key=True)
type_reunion = db.Column(db.Unicode)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment