Commit c87c4925 authored by Hinrikus Wolf's avatar Hinrikus Wolf

add migration

parent 4ccb3770
"""empty message
Revision ID: 7670a05866
Revises: 68688a3014
Create Date: 2015-11-07 12:14:03.278207
"""
# revision identifiers, used by Alembic.
revision = '7670a05866'
down_revision = '68688a3014'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('topics',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(), nullable=True),
sa.Column('mode', sa.String(), nullable=True),
sa.Column('event_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['event_id'], ['events.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('name')
)
op.drop_column('events', 'mode')
op.add_column('speakers', sa.Column('event_id', sa.Integer(), nullable=False))
op.drop_constraint('speakers_event_fkey', 'speakers', type_='foreignkey')
op.create_foreign_key(None, 'speakers', 'events', ['event_id'], ['id'])
op.drop_column('speakers', 'event')
op.add_column('statements', sa.Column('event_id', sa.Integer(), nullable=False))
op.add_column('statements', sa.Column('speaker_id', sa.Integer(), nullable=False))
op.drop_constraint('statements_event_fkey', 'statements', type_='foreignkey')
op.drop_constraint('statements_speaker_fkey', 'statements', type_='foreignkey')
op.create_foreign_key(None, 'statements', 'events', ['event_id'], ['id'])
op.create_foreign_key(None, 'statements', 'speakers', ['speaker_id'], ['id'])
op.drop_column('statements', 'event')
op.drop_column('statements', 'speaker')
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('statements', sa.Column('speaker', sa.INTEGER(), autoincrement=False, nullable=False))
op.add_column('statements', sa.Column('event', sa.INTEGER(), autoincrement=False, nullable=False))
op.drop_constraint(None, 'statements', type_='foreignkey')
op.drop_constraint(None, 'statements', type_='foreignkey')
op.create_foreign_key('statements_speaker_fkey', 'statements', 'speakers', ['speaker'], ['id'])
op.create_foreign_key('statements_event_fkey', 'statements', 'events', ['event'], ['id'])
op.drop_column('statements', 'speaker_id')
op.drop_column('statements', 'event_id')
op.add_column('speakers', sa.Column('event', sa.INTEGER(), autoincrement=False, nullable=False))
op.drop_constraint(None, 'speakers', type_='foreignkey')
op.create_foreign_key('speakers_event_fkey', 'speakers', 'events', ['event'], ['id'])
op.drop_column('speakers', 'event_id')
op.add_column('events', sa.Column('mode', sa.VARCHAR(), autoincrement=False, nullable=True))
op.drop_table('topics')
### 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