diff --git a/alembic/versions/47f5fab6f46a_private_pull_request.py b/alembic/versions/47f5fab6f46a_private_pull_request.py new file mode 100644 index 0000000..37e41c5 --- /dev/null +++ b/alembic/versions/47f5fab6f46a_private_pull_request.py @@ -0,0 +1,36 @@ +"""private pull-request + +Revision ID: 47f5fab6f46a +Revises: a13967424130 +Create Date: 2017-11-06 11:37:57.460886 + +""" + + +from alembic import op +import sqlalchemy as sa + +# revision identifiers, used by Alembic. +revision = '47f5fab6f46a' +down_revision = 'a13967424130' + +def upgrade(): + ''' Add a private column in the pull_requests table + ''' + op.add_column( + 'pull_requests', + sa.Column('private', sa.Boolean, nullable=True, default=False) + ) + op.execute('''UPDATE "pull_requests" ''' + '''SET private=False;''') + + op.alter_column( + 'pull_requests', + column_name='private', + nullable=False, existing_nullable=True) + + +def downgrade(): + ''' Remove the private column + ''' + op.drop_column('pull_requests', 'private') diff --git a/pagure/lib/model.py b/pagure/lib/model.py index 40b1440..9827b73 100644 --- a/pagure/lib/model.py +++ b/pagure/lib/model.py @@ -1680,6 +1680,9 @@ class PullRequest(BASE): ), nullable=True) + # While present this column isn't used anywhere yet + private = sa.Column(sa.Boolean, nullable=False, default=False) + status = sa.Column( sa.String(255), sa.ForeignKey(