Blame alembic/versions/ba538b2648b7_create_hook_mirror_table.py
|
Pierre-Yves Chibon |
c352b7 |
"""create hook_mirror table
|
|
Pierre-Yves Chibon |
c352b7 |
|
|
Pierre-Yves Chibon |
c352b7 |
Revision ID: ba538b2648b7
|
|
Pierre-Yves Chibon |
c352b7 |
Revises: 19b67f4b9fe4
|
|
Pierre-Yves Chibon |
c352b7 |
Create Date: 2018-09-27 12:47:21.975843
|
|
Pierre-Yves Chibon |
c352b7 |
|
|
Pierre-Yves Chibon |
c352b7 |
"""
|
|
Pierre-Yves Chibon |
c352b7 |
|
|
Pierre-Yves Chibon |
c352b7 |
# revision identifiers, used by Alembic.
|
|
Pierre-Yves Chibon |
c352b7 |
revision = 'ba538b2648b7'
|
|
Pierre-Yves Chibon |
c352b7 |
down_revision = '19b67f4b9fe4'
|
|
Pierre-Yves Chibon |
c352b7 |
|
|
Pierre-Yves Chibon |
c352b7 |
from alembic import op
|
|
Pierre-Yves Chibon |
c352b7 |
import sqlalchemy as sa
|
|
Pierre-Yves Chibon |
c352b7 |
|
|
Pierre-Yves Chibon |
c352b7 |
|
|
Pierre-Yves Chibon |
c352b7 |
def upgrade():
|
|
Pierre-Yves Chibon |
c352b7 |
""" Create the hook_mirror to store the tags of pull-requests.
|
|
Pierre-Yves Chibon |
c352b7 |
"""
|
|
Pierre-Yves Chibon |
c352b7 |
op.create_table(
|
|
Pierre-Yves Chibon |
c352b7 |
'hook_mirror',
|
|
Pierre-Yves Chibon |
c352b7 |
sa.Column(
|
|
Pierre-Yves Chibon |
c352b7 |
'id',
|
|
Pierre-Yves Chibon |
c352b7 |
sa.Integer,
|
|
Pierre-Yves Chibon |
c352b7 |
primary_key=True),
|
|
Pierre-Yves Chibon |
c352b7 |
sa.Column(
|
|
Pierre-Yves Chibon |
c352b7 |
'project_id',
|
|
Pierre-Yves Chibon |
c352b7 |
sa.Integer,
|
|
Pierre-Yves Chibon |
c352b7 |
sa.ForeignKey(
|
|
Pierre-Yves Chibon |
c352b7 |
'projects.id', onupdate='CASCADE', ondelete='CASCADE'
|
|
Pierre-Yves Chibon |
c352b7 |
),
|
|
Pierre-Yves Chibon |
c352b7 |
nullable=False,
|
|
Pierre-Yves Chibon |
c352b7 |
primary_key=True
|
|
Pierre-Yves Chibon |
c352b7 |
),
|
|
Pierre-Yves Chibon |
c352b7 |
sa.Column(
|
|
Pierre-Yves Chibon |
c352b7 |
'active',
|
|
Pierre-Yves Chibon |
c352b7 |
sa.Boolean,
|
|
Pierre-Yves Chibon |
c352b7 |
nullable=False,
|
|
Pierre-Yves Chibon |
c352b7 |
default=False
|
|
Pierre-Yves Chibon |
927d61 |
),
|
|
Pierre-Yves Chibon |
927d61 |
sa.Column(
|
|
Pierre-Yves Chibon |
927d61 |
'public_key',
|
|
Pierre-Yves Chibon |
927d61 |
sa.Text,
|
|
Pierre-Yves Chibon |
927d61 |
nullable=True
|
|
Pierre-Yves Chibon |
927d61 |
),
|
|
Pierre-Yves Chibon |
927d61 |
sa.Column(
|
|
Pierre-Yves Chibon |
927d61 |
'target',
|
|
Pierre-Yves Chibon |
927d61 |
sa.Text,
|
|
Pierre-Yves Chibon |
927d61 |
nullable=True
|
|
Pierre-Yves Chibon |
927d61 |
),
|
|
Pierre-Yves Chibon |
927d61 |
sa.Column(
|
|
Pierre-Yves Chibon |
927d61 |
'last_log',
|
|
Pierre-Yves Chibon |
927d61 |
sa.Text,
|
|
Pierre-Yves Chibon |
927d61 |
nullable=True
|
|
Pierre-Yves Chibon |
c352b7 |
)
|
|
Pierre-Yves Chibon |
c352b7 |
)
|
|
Pierre-Yves Chibon |
c352b7 |
|
|
Pierre-Yves Chibon |
c352b7 |
|
|
Pierre-Yves Chibon |
c352b7 |
def downgrade():
|
|
Pierre-Yves Chibon |
c352b7 |
""" Delete the hook_mirror table. """
|
|
Pierre-Yves Chibon |
c352b7 |
op.drop_table('hook_mirror')
|