Blame alembic/versions/369deb8c8b63_add_the_pr_to_issue_table.py
|
Pierre-Yves Chibon |
88c073 |
"""Add the pr_to_issue table
|
|
Pierre-Yves Chibon |
88c073 |
|
|
Pierre-Yves Chibon |
88c073 |
Revision ID: 369deb8c8b63
|
|
Pierre-Yves Chibon |
88c073 |
Revises: eab41ce5f92a
|
|
Pierre-Yves Chibon |
88c073 |
Create Date: 2018-03-12 11:38:00.955252
|
|
Pierre-Yves Chibon |
88c073 |
|
|
Pierre-Yves Chibon |
88c073 |
"""
|
|
Pierre-Yves Chibon |
88c073 |
|
|
Pierre-Yves Chibon |
88c073 |
# revision identifiers, used by Alembic.
|
|
Pierre-Yves Chibon |
88c073 |
revision = '369deb8c8b63'
|
|
Pierre-Yves Chibon |
88c073 |
down_revision = 'eab41ce5f92a'
|
|
Pierre-Yves Chibon |
88c073 |
|
|
Pierre-Yves Chibon |
88c073 |
from alembic import op
|
|
Pierre-Yves Chibon |
88c073 |
import sqlalchemy as sa
|
|
Pierre-Yves Chibon |
88c073 |
|
|
Pierre-Yves Chibon |
88c073 |
|
|
Pierre-Yves Chibon |
88c073 |
def upgrade():
|
|
Pierre-Yves Chibon |
88c073 |
''' Create the pr_to_issue table. '''
|
|
Pierre-Yves Chibon |
88c073 |
|
|
Pierre-Yves Chibon |
88c073 |
op.create_table(
|
|
Pierre-Yves Chibon |
88c073 |
'pr_to_issue',
|
|
Pierre-Yves Chibon |
88c073 |
sa.Column(
|
|
Pierre-Yves Chibon |
88c073 |
'pull_request_uid',
|
|
Pierre-Yves Chibon |
88c073 |
sa.String(32),
|
|
Pierre-Yves Chibon |
88c073 |
sa.ForeignKey(
|
|
Pierre-Yves Chibon |
88c073 |
'pull_requests.uid', ondelete='CASCADE', onupdate='CASCADE',
|
|
Pierre-Yves Chibon |
88c073 |
),
|
|
Pierre-Yves Chibon |
88c073 |
primary_key=True),
|
|
Pierre-Yves Chibon |
88c073 |
sa.Column(
|
|
Pierre-Yves Chibon |
88c073 |
'issue_uid',
|
|
Pierre-Yves Chibon |
88c073 |
sa.String(32),
|
|
Pierre-Yves Chibon |
88c073 |
sa.ForeignKey(
|
|
Pierre-Yves Chibon |
88c073 |
'issues.uid', ondelete='CASCADE', onupdate='CASCADE',
|
|
Pierre-Yves Chibon |
88c073 |
),
|
|
Pierre-Yves Chibon |
88c073 |
primary_key=True)
|
|
Pierre-Yves Chibon |
88c073 |
)
|
|
Pierre-Yves Chibon |
88c073 |
|
|
Pierre-Yves Chibon |
88c073 |
|
|
Pierre-Yves Chibon |
88c073 |
def downgrade():
|
|
Pierre-Yves Chibon |
88c073 |
''' Drop the pr_to_issue table. '''
|
|
Pierre-Yves Chibon |
88c073 |
|
|
Pierre-Yves Chibon |
88c073 |
op.drop_table('pr_to_issue')
|