15ea3c2cf83d_pr_comment_editing.py 1019 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. """Adding column to store edited_by and edited_on a PR comment
  2. Revision ID: 15ea3c2cf83d
  3. Revises: 1cd0a853c697
  4. Create Date: 2015-11-09 16:18:47.192088
  5. """
  6. # revision identifiers, used by Alembic.
  7. revision = '15ea3c2cf83d'
  8. down_revision = '1cd0a853c697'
  9. from alembic import op
  10. import sqlalchemy as sa
  11. def upgrade():
  12. ''' Add the columns editor_id and edited_on to the table
  13. pull_request_comments.
  14. '''
  15. op.add_column(
  16. 'pull_request_comments',
  17. sa.Column(
  18. 'editor_id',
  19. sa.Integer,
  20. sa.ForeignKey('users.id', onupdate='CASCADE'),
  21. nullable=True)
  22. )
  23. op.add_column(
  24. 'pull_request_comments',
  25. sa.Column(
  26. 'edited_on',
  27. sa.DateTime,
  28. nullable=True)
  29. )
  30. def downgrade():
  31. ''' Remove the columns editor_id and edited_on from the table
  32. pull_request_comments.
  33. '''
  34. op.drop_column('pull_request_comments', 'editor_id')
  35. op.drop_column('pull_request_comments', 'edited_on')