Blame alembic/versions/15ea3c2cf83d_pr_comment_editing.py
|
Pierre-Yves Chibon |
a10480 |
"""Adding column to store edited_by and edited_on a PR comment
|
|
farhaanbukhsh |
a04e02 |
|
|
farhaanbukhsh |
a04e02 |
Revision ID: 15ea3c2cf83d
|
|
Pierre-Yves Chibon |
9c2cec |
Revises: 1cd0a853c697
|
|
farhaanbukhsh |
a04e02 |
Create Date: 2015-11-09 16:18:47.192088
|
|
farhaanbukhsh |
a04e02 |
|
|
farhaanbukhsh |
a04e02 |
"""
|
|
farhaanbukhsh |
a04e02 |
|
|
farhaanbukhsh |
a04e02 |
# revision identifiers, used by Alembic.
|
|
farhaanbukhsh |
a04e02 |
revision = '15ea3c2cf83d'
|
|
Pierre-Yves Chibon |
9c2cec |
down_revision = '1cd0a853c697'
|
|
farhaanbukhsh |
a04e02 |
|
|
farhaanbukhsh |
a04e02 |
from alembic import op
|
|
farhaanbukhsh |
a04e02 |
import sqlalchemy as sa
|
|
farhaanbukhsh |
a04e02 |
|
|
farhaanbukhsh |
a04e02 |
|
|
farhaanbukhsh |
a04e02 |
def upgrade():
|
|
Pierre-Yves Chibon |
0224b6 |
''' Add the columns editor_id and edited_on to the table
|
|
Pierre-Yves Chibon |
0224b6 |
pull_request_comments.
|
|
Pierre-Yves Chibon |
0224b6 |
'''
|
|
farhaanbukhsh |
a04e02 |
|
|
farhaanbukhsh |
a04e02 |
op.add_column(
|
|
farhaanbukhsh |
a04e02 |
'pull_request_comments',
|
|
farhaanbukhsh |
a04e02 |
sa.Column(
|
|
farhaanbukhsh |
a04e02 |
'editor_id',
|
|
farhaanbukhsh |
a04e02 |
sa.Integer,
|
|
farhaanbukhsh |
a04e02 |
sa.ForeignKey('users.id', onupdate='CASCADE'),
|
|
farhaanbukhsh |
a04e02 |
nullable=True)
|
|
farhaanbukhsh |
a04e02 |
)
|
|
farhaanbukhsh |
a04e02 |
|
|
farhaanbukhsh |
a04e02 |
op.add_column(
|
|
farhaanbukhsh |
a04e02 |
'pull_request_comments',
|
|
farhaanbukhsh |
a04e02 |
sa.Column(
|
|
farhaanbukhsh |
a04e02 |
'edited_on',
|
|
Pierre-Yves Chibon |
9c2cec |
sa.DateTime,
|
|
farhaanbukhsh |
a04e02 |
nullable=True)
|
|
farhaanbukhsh |
a04e02 |
)
|
|
farhaanbukhsh |
a04e02 |
|
|
farhaanbukhsh |
a04e02 |
|
|
farhaanbukhsh |
a04e02 |
def downgrade():
|
|
Pierre-Yves Chibon |
0224b6 |
''' Remove the columns editor_id and edited_on from the table
|
|
Pierre-Yves Chibon |
0224b6 |
pull_request_comments.
|
|
Pierre-Yves Chibon |
0224b6 |
'''
|
|
farhaanbukhsh |
a04e02 |
op.drop_column('pull_request_comments', 'editor_id')
|
|
farhaanbukhsh |
a04e02 |
op.drop_column('pull_request_comments', 'edited_on')
|