770149d96e24_nullable_project_for_api_token.py 711 B

1234567891011121314151617181920212223242526272829303132333435
  1. """nullable project for api token
  2. Revision ID: 770149d96e24
  3. Revises: 11470abae0d6
  4. Create Date: 2017-03-04 18:05:07.956057
  5. """
  6. # revision identifiers, used by Alembic.
  7. revision = '770149d96e24'
  8. down_revision = '11470abae0d6'
  9. from alembic import op
  10. import sqlalchemy as sa
  11. def upgrade():
  12. """ Make the field 'project_id' of the table tokens be nullable. """
  13. op.alter_column(
  14. 'tokens',
  15. 'project_id',
  16. nullable=True,
  17. existing_nullable=False,
  18. )
  19. def downgrade():
  20. """ Make the field 'project_id' of the table tokens be not nullable.
  21. """
  22. op.alter_column(
  23. 'tokens',
  24. 'project_id',
  25. nullable=False,
  26. existing_nullable=True,
  27. )