369deb8c8b63_add_the_pr_to_issue_table.py 914 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. """Add the pr_to_issue table
  2. Revision ID: 369deb8c8b63
  3. Revises: eab41ce5f92a
  4. Create Date: 2018-03-12 11:38:00.955252
  5. """
  6. # revision identifiers, used by Alembic.
  7. revision = '369deb8c8b63'
  8. down_revision = 'eab41ce5f92a'
  9. from alembic import op
  10. import sqlalchemy as sa
  11. def upgrade():
  12. ''' Create the pr_to_issue table. '''
  13. op.create_table(
  14. 'pr_to_issue',
  15. sa.Column(
  16. 'pull_request_uid',
  17. sa.String(32),
  18. sa.ForeignKey(
  19. 'pull_requests.uid', ondelete='CASCADE', onupdate='CASCADE',
  20. ),
  21. primary_key=True),
  22. sa.Column(
  23. 'issue_uid',
  24. sa.String(32),
  25. sa.ForeignKey(
  26. 'issues.uid', ondelete='CASCADE', onupdate='CASCADE',
  27. ),
  28. primary_key=True)
  29. )
  30. def downgrade():
  31. ''' Drop the pr_to_issue table. '''
  32. op.drop_table('pr_to_issue')