Skip to content
Snippets Groups Projects
Commit 9dde8391 authored by Patrick Jentsch's avatar Patrick Jentsch
Browse files

Add migration for new database design

parent a25cbf4b
No related branches found
No related tags found
No related merge requests found
"""empty message
Revision ID: 6c2227f1cc77
Revises: befe5326787e
Create Date: 2020-12-02 08:50:45.880062
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '6c2227f1cc77'
down_revision = 'befe5326787e'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('notification_data')
op.drop_table('notification_email_data')
op.drop_column('corpus_files', 'dir')
op.drop_column('job_inputs', 'dir')
op.drop_column('job_results', 'dir')
op.drop_column('jobs', 'secure_filename')
op.alter_column('roles', 'permissions',
existing_type=sa.BIGINT(),
type_=sa.Integer(),
existing_nullable=True)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('roles', 'permissions',
existing_type=sa.Integer(),
type_=sa.BIGINT(),
existing_nullable=True)
op.add_column('jobs', sa.Column('secure_filename', sa.VARCHAR(length=32), autoincrement=False, nullable=True))
op.add_column('job_results', sa.Column('dir', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
op.add_column('job_inputs', sa.Column('dir', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
op.add_column('corpus_files', sa.Column('dir', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
op.create_table('notification_email_data',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('job_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('notify_status', sa.VARCHAR(length=16), autoincrement=False, nullable=True),
sa.Column('creation_date', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.ForeignKeyConstraint(['job_id'], ['jobs.id'], name='notification_email_data_job_id_fkey'),
sa.PrimaryKeyConstraint('id', name='notification_email_data_pkey')
)
op.create_table('notification_data',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('job_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('notified_on', sa.VARCHAR(length=16), autoincrement=False, nullable=True),
sa.ForeignKeyConstraint(['job_id'], ['jobs.id'], name='notification_data_job_id_fkey'),
sa.PrimaryKeyConstraint('id', name='notification_data_pkey')
)
# ### end Alembic commands ###
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment