fossasia/open-event-orga-server

View on GitHub
migrations/versions/rev-2023-08-11-15:26:07-1af4cc4f7cd5_.py

Summary

Maintainability
A
55 mins
Test Coverage
"""empty message

Revision ID: 1af4cc4f7cd5
Revises: 24271525a263
Create Date: 2023-08-11 15:26:07.373388

"""

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '1af4cc4f7cd5'
down_revision = '24271525a263'


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('tags',
    sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(), nullable=False),
    sa.Column('color', sa.String(), nullable=True),
    sa.Column('is_read_only', sa.Boolean(), nullable=False),
    sa.Column('event_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['event_id'], ['events.id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column('ticket_holders', sa.Column('tag_id', sa.Integer(), nullable=True))
    op.create_foreign_key(u'ticket_holders_tag_id_fkey', 'ticket_holders', 'tags', ['tag_id'], ['id'], ondelete='CASCADE')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(u'ticket_holders_tag_id_fkey', 'ticket_holders', type_='foreignkey')
    op.drop_column('ticket_holders', 'tag_id')
    op.drop_table('tags')
    # ### end Alembic commands ###