politikorama/migrations/versions/6ce21d3cdf0e_.py

180 lines
7.8 KiB
Python

"""empty message
Revision ID: 6ce21d3cdf0e
Revises:
Create Date: 2021-07-24 09:44:44.681657
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '6ce21d3cdf0e'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('country',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=200), nullable=True),
sa.Column('slug', sa.String(length=200), nullable=True),
sa.Column('code', sa.String(length=20), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('matter',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=200), nullable=True),
sa.Column('slug', sa.String(length=200), nullable=True),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('active', sa.Boolean(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('slug')
)
op.create_table('role',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=200), nullable=True),
sa.Column('slug', sa.String(length=200), nullable=True),
sa.Column('code', sa.String(length=20), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('type',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=200), nullable=True),
sa.Column('slug', sa.String(length=200), nullable=True),
sa.Column('code', sa.String(length=20), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('address',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=200), nullable=True),
sa.Column('slug', sa.String(length=200), nullable=True),
sa.Column('country_id', sa.Integer(), nullable=True),
sa.Column('number', sa.String(length=20), nullable=True),
sa.Column('street', sa.String(length=2000), nullable=True),
sa.Column('miscellaneous', sa.String(length=2000), nullable=True),
sa.Column('city', sa.String(length=2000), nullable=True),
sa.Column('zipcode', sa.String(length=20), nullable=True),
sa.Column('building', sa.String(length=20), nullable=True),
sa.Column('floor', sa.String(length=20), nullable=True),
sa.Column('stair', sa.String(length=20), nullable=True),
sa.Column('office', sa.String(length=20), nullable=True),
sa.Column('latitude', sa.String(length=20), nullable=True),
sa.Column('longitude', sa.String(length=20), nullable=True),
sa.ForeignKeyConstraint(['country_id'], ['country.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('entity',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=200), nullable=True),
sa.Column('slug', sa.String(length=200), nullable=True),
sa.Column('code', sa.String(length=20), nullable=True),
sa.Column('picture', sa.String(length=2000), nullable=True),
sa.Column('type_id', sa.Integer(), nullable=True),
sa.Column('start', sa.Date(), nullable=True),
sa.Column('end', sa.Date(), nullable=True),
sa.Column('country_id', sa.Integer(), nullable=True),
sa.Column('parent_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['country_id'], ['country.id'], ),
sa.ForeignKeyConstraint(['parent_id'], ['entity.id'], ),
sa.ForeignKeyConstraint(['type_id'], ['type.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('representative',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('code', sa.String(length=20), nullable=True),
sa.Column('name', sa.String(length=200), nullable=True),
sa.Column('slug', sa.String(length=200), nullable=True),
sa.Column('active', sa.Boolean(), nullable=True),
sa.Column('picture', sa.String(length=2000), nullable=True),
sa.Column('nationality_id', sa.Integer(), nullable=True),
sa.Column('sex', sa.String(length=1), nullable=True),
sa.Column('birth_date', sa.Date(), nullable=True),
sa.Column('birth_place', sa.String(length=2000), nullable=True),
sa.Column('job', sa.String(length=2000), nullable=True),
sa.ForeignKeyConstraint(['nationality_id'], ['country.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('code')
)
op.create_table('contact',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('representative_id', sa.Integer(), nullable=True),
sa.Column('address_id', sa.Integer(), nullable=True),
sa.Column('name', sa.String(length=200), nullable=True),
sa.Column('slug', sa.String(length=200), nullable=True),
sa.Column('value', sa.String(length=2000), nullable=True),
sa.ForeignKeyConstraint(['address_id'], ['address.id'], ),
sa.ForeignKeyConstraint(['representative_id'], ['representative.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('membership',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('representative_id', sa.Integer(), nullable=True),
sa.Column('role_id', sa.Integer(), nullable=True),
sa.Column('start', sa.Date(), nullable=True),
sa.Column('end', sa.Date(), nullable=True),
sa.Column('entity_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['entity_id'], ['entity.id'], ),
sa.ForeignKeyConstraint(['representative_id'], ['representative.id'], ),
sa.ForeignKeyConstraint(['role_id'], ['role.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('recommendation',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('matter_id', sa.Integer(), nullable=True),
sa.Column('entity_id', sa.Integer(), nullable=True),
sa.Column('name', sa.String(length=200), nullable=True),
sa.Column('slug', sa.String(length=200), nullable=True),
sa.Column('code', sa.String(length=20), nullable=True),
sa.Column('date', sa.Date(), nullable=True),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('value', sa.String(length=200), nullable=True),
sa.Column('weight', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['entity_id'], ['entity.id'], ),
sa.ForeignKeyConstraint(['matter_id'], ['matter.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('stance',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('representative_id', sa.Integer(), nullable=True),
sa.Column('matter_id', sa.Integer(), nullable=True),
sa.Column('date', sa.Date(), nullable=True),
sa.Column('subject', sa.String(length=2000), nullable=True),
sa.Column('extract', sa.Text(), nullable=True),
sa.Column('source_url', sa.String(length=2000), nullable=True),
sa.Column('active', sa.Boolean(), nullable=True),
sa.ForeignKeyConstraint(['matter_id'], ['matter.id'], ),
sa.ForeignKeyConstraint(['representative_id'], ['representative.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('decision',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('representative_id', sa.Integer(), nullable=True),
sa.Column('recommendation_id', sa.Integer(), nullable=True),
sa.Column('value', sa.String(length=200), nullable=True),
sa.ForeignKeyConstraint(['recommendation_id'], ['recommendation.id'], ),
sa.ForeignKeyConstraint(['representative_id'], ['representative.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('decision')
op.drop_table('stance')
op.drop_table('recommendation')
op.drop_table('membership')
op.drop_table('contact')
op.drop_table('representative')
op.drop_table('entity')
op.drop_table('address')
op.drop_table('type')
op.drop_table('role')
op.drop_table('matter')
op.drop_table('country')
# ### end Alembic commands ###