From 1ab5757fde10c01338f35c4eabd5bb98e19c4d6f Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Nov 24 2017 08:35:42 +0000 Subject: Add a private column to the pull_requests table This makes the PR object closer to the Issue one allowing to re-share more code and having private PRs is something that has already been asked (cf ticket #1893) for pagure so this is laying ground for it. Signed-off-by: Pierre-Yves Chibon --- 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(