Blame alembic/versions/22fb5256f555_update_rtd_table.py
|
Pierre-Yves Chibon |
613b67 |
"""Update RTD table
|
|
Pierre-Yves Chibon |
613b67 |
|
|
Pierre-Yves Chibon |
613b67 |
Revision ID: 22fb5256f555
|
|
Pierre-Yves Chibon |
613b67 |
Revises: 5affe6f5d94f
|
|
Pierre-Yves Chibon |
613b67 |
Create Date: 2018-03-07 15:46:26.478238
|
|
Pierre-Yves Chibon |
613b67 |
|
|
Pierre-Yves Chibon |
613b67 |
"""
|
|
Pierre-Yves Chibon |
613b67 |
|
|
Pierre-Yves Chibon |
613b67 |
# revision identifiers, used by Alembic.
|
|
Pierre-Yves Chibon |
613b67 |
revision = '22fb5256f555'
|
|
Pierre-Yves Chibon |
613b67 |
down_revision = '5affe6f5d94f'
|
|
Pierre-Yves Chibon |
613b67 |
|
|
Pierre-Yves Chibon |
613b67 |
from alembic import op
|
|
Pierre-Yves Chibon |
613b67 |
import sqlalchemy as sa
|
|
Pierre-Yves Chibon |
613b67 |
|
|
Pierre-Yves Chibon |
613b67 |
|
|
Pierre-Yves Chibon |
613b67 |
def upgrade():
|
|
Pierre-Yves Chibon |
613b67 |
''' Update the hook_rtd table for the new data structure it should use.
|
|
Pierre-Yves Chibon |
613b67 |
'''
|
|
Pierre-Yves Chibon |
613b67 |
op.add_column(
|
|
Pierre-Yves Chibon |
613b67 |
'hook_rtd',
|
|
Pierre-Yves Chibon |
613b67 |
sa.Column('api_url', sa.Text, nullable=True)
|
|
Pierre-Yves Chibon |
613b67 |
)
|
|
Pierre-Yves Chibon |
613b67 |
op.add_column(
|
|
Pierre-Yves Chibon |
613b67 |
'hook_rtd',
|
|
Pierre-Yves Chibon |
613b67 |
sa.Column('api_token', sa.Text, nullable=True)
|
|
Pierre-Yves Chibon |
613b67 |
)
|
|
Pierre-Yves Chibon |
613b67 |
op.drop_column('hook_rtd', 'project_name')
|
|
Pierre-Yves Chibon |
613b67 |
|
|
Pierre-Yves Chibon |
613b67 |
|
|
Pierre-Yves Chibon |
613b67 |
def downgrade():
|
|
Pierre-Yves Chibon |
613b67 |
''' Downgrade the structure of the hook_rtd table.
|
|
Pierre-Yves Chibon |
613b67 |
'''
|
|
Pierre-Yves Chibon |
613b67 |
op.drop_column('hook_rtd', 'api_url')
|
|
Pierre-Yves Chibon |
613b67 |
op.drop_column('hook_rtd', 'api_token')
|
|
Pierre-Yves Chibon |
613b67 |
op.add_column(
|
|
Pierre-Yves Chibon |
613b67 |
'hook_rtd',
|
|
Pierre-Yves Chibon |
613b67 |
sa.Column('project_name', sa.Text, nullable=True)
|
|
Pierre-Yves Chibon |
613b67 |
)
|