From c352b7d4e4f90e484ac1fa785aca081b73d6fdf6 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Sep 27 2018 11:51:11 +0000 Subject: Add missing alembic migration to create the hook_mirror table Fixes https://pagure.io/pagure/issue/3692 Signed-off-by: Pierre-Yves Chibon --- diff --git a/alembic/versions/ba538b2648b7_create_hook_mirror_table.py b/alembic/versions/ba538b2648b7_create_hook_mirror_table.py new file mode 100644 index 0000000..0897092 --- /dev/null +++ b/alembic/versions/ba538b2648b7_create_hook_mirror_table.py @@ -0,0 +1,46 @@ +"""create hook_mirror table + +Revision ID: ba538b2648b7 +Revises: 19b67f4b9fe4 +Create Date: 2018-09-27 12:47:21.975843 + +""" + +# revision identifiers, used by Alembic. +revision = 'ba538b2648b7' +down_revision = '19b67f4b9fe4' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + """ Create the hook_mirror to store the tags of pull-requests. + """ + op.create_table( + 'hook_mirror', + sa.Column( + 'id', + sa.Integer, + primary_key=True), + sa.Column( + 'project_id', + sa.Integer, + sa.ForeignKey( + 'projects.id', onupdate='CASCADE', ondelete='CASCADE' + ), + nullable=False, + primary_key=True + ), + sa.Column( + 'active', + sa.Boolean, + nullable=False, + default=False + ) + ) + + +def downgrade(): + """ Delete the hook_mirror table. """ + op.drop_table('hook_mirror')