22fb5256f555_update_rtd_table.py 878 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. """Update RTD table
  2. Revision ID: 22fb5256f555
  3. Revises: 5affe6f5d94f
  4. Create Date: 2018-03-07 15:46:26.478238
  5. """
  6. # revision identifiers, used by Alembic.
  7. revision = '22fb5256f555'
  8. down_revision = '5affe6f5d94f'
  9. from alembic import op
  10. import sqlalchemy as sa
  11. def upgrade():
  12. ''' Update the hook_rtd table for the new data structure it should use.
  13. '''
  14. op.add_column(
  15. 'hook_rtd',
  16. sa.Column('api_url', sa.Text, nullable=True)
  17. )
  18. op.add_column(
  19. 'hook_rtd',
  20. sa.Column('api_token', sa.Text, nullable=True)
  21. )
  22. op.drop_column('hook_rtd', 'project_name')
  23. def downgrade():
  24. ''' Downgrade the structure of the hook_rtd table.
  25. '''
  26. op.drop_column('hook_rtd', 'api_url')
  27. op.drop_column('hook_rtd', 'api_token')
  28. op.add_column(
  29. 'hook_rtd',
  30. sa.Column('project_name', sa.Text, nullable=True)
  31. )