Commit bfbd79d1 authored by Nicolas Joyard's avatar Nicolas Joyard

Ajout modèle action

parent b5996e5a
......@@ -3,4 +3,4 @@
from .database import db
from .parlementaire import Groupe, Parlementaire
from .procedure import Etape
from .procedure import Action, Etape
......@@ -43,3 +43,5 @@ class Parlementaire(db.Model):
etape_id = db.Column(db.Integer, db.ForeignKey('etapes.id'))
etape = db.relationship('Etape', back_populates='parlementaires')
actions = db.relationship('Action', back_populates='parlementaire')
......@@ -15,3 +15,20 @@ class Etape(db.Model):
couleur = db.Column(db.Unicode)
parlementaires = db.relationship('Parlementaire', back_populates='etape')
class Action(db.Model):
__tablename__ = 'actions'
id = db.Column(db.Integer, primary_key=True)
date = db.Column(db.DateTime)
nick = db.Column(db.Unicode)
email = db.Column(db.Unicode)
attachment = db.Column(db.Unicode)
etape_id = db.Column(db.Integer, db.ForeignKey('etapes.id'))
etape = db.relationship('Etape')
parlementaire_id = db.Column(db.Integer, db.ForeignKey('parlementaires.id'))
parlementaire = db.relationship('Parlementaire', back_populates='actions')
"""Ajout actions
Revision ID: 363c7cedd3bd
Revises: 2267f3efb8fa
Create Date: 2017-05-07 12:26:54.579934
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '363c7cedd3bd'
down_revision = '2267f3efb8fa'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('actions',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('date', sa.DateTime(), nullable=True),
sa.Column('nick', sa.Unicode(), nullable=True),
sa.Column('email', sa.Unicode(), nullable=True),
sa.Column('attachment', sa.Unicode(), nullable=True),
sa.Column('etape_id', sa.Integer(), nullable=True),
sa.Column('parlementaire_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['etape_id'], ['etapes.id'], ),
sa.ForeignKeyConstraint(['parlementaire_id'], ['parlementaires.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('actions')
# ### end Alembic commands ###
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