Blame alembic/versions/3b441ef4e928_comment_editing_issue.py
|
Pierre-Yves Chibon |
a10480 |
"""Adding column to store edited_by and edited_on a issue comment
|
|
Pierre-Yves Chibon |
230af1 |
|
|
Pierre-Yves Chibon |
230af1 |
Revision ID: 3b441ef4e928
|
|
Pierre-Yves Chibon |
230af1 |
Revises: 15ea3c2cf83d
|
|
Pierre-Yves Chibon |
230af1 |
Create Date: 2015-12-03 12:34:28.316699
|
|
Pierre-Yves Chibon |
230af1 |
|
|
Pierre-Yves Chibon |
230af1 |
"""
|
|
Pierre-Yves Chibon |
230af1 |
|
|
Pierre-Yves Chibon |
230af1 |
# revision identifiers, used by Alembic.
|
|
Pierre-Yves Chibon |
230af1 |
revision = '3b441ef4e928'
|
|
Pierre-Yves Chibon |
230af1 |
down_revision = '15ea3c2cf83d'
|
|
Pierre-Yves Chibon |
230af1 |
|
|
Pierre-Yves Chibon |
230af1 |
from alembic import op
|
|
Pierre-Yves Chibon |
230af1 |
import sqlalchemy as sa
|
|
Pierre-Yves Chibon |
230af1 |
|
|
Pierre-Yves Chibon |
230af1 |
|
|
Pierre-Yves Chibon |
230af1 |
def upgrade():
|
|
Pierre-Yves Chibon |
230af1 |
''' Add the columns editor_id and edited_on to the table issue_comments.
|
|
Pierre-Yves Chibon |
230af1 |
'''
|
|
Pierre-Yves Chibon |
230af1 |
|
|
Pierre-Yves Chibon |
230af1 |
op.add_column(
|
|
Pierre-Yves Chibon |
230af1 |
'issue_comments',
|
|
Pierre-Yves Chibon |
230af1 |
sa.Column(
|
|
Pierre-Yves Chibon |
230af1 |
'editor_id',
|
|
Pierre-Yves Chibon |
230af1 |
sa.Integer,
|
|
Pierre-Yves Chibon |
230af1 |
sa.ForeignKey('users.id', onupdate='CASCADE'),
|
|
Pierre-Yves Chibon |
230af1 |
nullable=True)
|
|
Pierre-Yves Chibon |
230af1 |
)
|
|
Pierre-Yves Chibon |
230af1 |
|
|
Pierre-Yves Chibon |
230af1 |
op.add_column(
|
|
Pierre-Yves Chibon |
230af1 |
'issue_comments',
|
|
Pierre-Yves Chibon |
230af1 |
sa.Column(
|
|
Pierre-Yves Chibon |
230af1 |
'edited_on',
|
|
Pierre-Yves Chibon |
230af1 |
sa.DateTime,
|
|
Pierre-Yves Chibon |
230af1 |
nullable=True)
|
|
Pierre-Yves Chibon |
230af1 |
)
|
|
Pierre-Yves Chibon |
230af1 |
|
|
Pierre-Yves Chibon |
230af1 |
|
|
Pierre-Yves Chibon |
230af1 |
def downgrade():
|
|
Pierre-Yves Chibon |
230af1 |
''' Remove the columns editor_id and edited_on from the table
|
|
Pierre-Yves Chibon |
230af1 |
issue_comments.
|
|
Pierre-Yves Chibon |
230af1 |
'''
|
|
Pierre-Yves Chibon |
230af1 |
op.drop_column('issue_comments', 'editor_id')
|
|
Pierre-Yves Chibon |
230af1 |
op.drop_column('issue_comments', 'edited_on')
|