1
0

3b441ef4e928_comment_editing_issue.py 976 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. """Adding column to store edited_by and edited_on a issue comment
  2. Revision ID: 3b441ef4e928
  3. Revises: 15ea3c2cf83d
  4. Create Date: 2015-12-03 12:34:28.316699
  5. """
  6. # revision identifiers, used by Alembic.
  7. revision = '3b441ef4e928'
  8. down_revision = '15ea3c2cf83d'
  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 issue_comments.
  13. '''
  14. op.add_column(
  15. 'issue_comments',
  16. sa.Column(
  17. 'editor_id',
  18. sa.Integer,
  19. sa.ForeignKey('users.id', onupdate='CASCADE'),
  20. nullable=True)
  21. )
  22. op.add_column(
  23. 'issue_comments',
  24. sa.Column(
  25. 'edited_on',
  26. sa.DateTime,
  27. nullable=True)
  28. )
  29. def downgrade():
  30. ''' Remove the columns editor_id and edited_on from the table
  31. issue_comments.
  32. '''
  33. op.drop_column('issue_comments', 'editor_id')
  34. op.drop_column('issue_comments', 'edited_on')