33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
"""add inviter relationship to invitation
|
|
|
|
Revision ID: 2bec1868a22a
|
|
Revises: c7feaa7b6b0c
|
|
Create Date: 2018-10-26 12:45:13.192062
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '2bec1868a22a'
|
|
down_revision = 'c7feaa7b6b0c'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.add_column('invitations', sa.Column('inviter_id', postgresql.UUID(as_uuid=True), nullable=True))
|
|
op.create_index(op.f('ix_invitations_inviter_id'), 'invitations', ['inviter_id'], unique=False)
|
|
op.create_foreign_key(None, 'invitations', 'users', ['inviter_id'], ['id'])
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_constraint(None, 'invitations', type_='foreignkey')
|
|
op.drop_index(op.f('ix_invitations_inviter_id'), table_name='invitations')
|
|
op.drop_column('invitations', 'inviter_id')
|
|
# ### end Alembic commands ###
|