pyfedi/migrations/versions/3fb833e34c75_user_registration_processing.py

48 lines
1.6 KiB
Python
Raw Permalink Normal View History

2024-02-02 15:30:03 +13:00
"""user registration processing
Revision ID: 3fb833e34c75
Revises: 52e8d73b69ba
Create Date: 2024-02-02 11:56:44.895871
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '3fb833e34c75'
down_revision = '52e8d73b69ba'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('user_registration',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('answer', sa.String(length=512), nullable=True),
sa.Column('status', sa.Integer(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('approved_at', sa.DateTime(), nullable=True),
sa.Column('approved_by', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['approved_by'], ['user.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('id')
)
with op.batch_alter_table('user_registration', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_user_registration_status'), ['status'], unique=False)
batch_op.create_index(batch_op.f('ix_user_registration_user_id'), ['user_id'], unique=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('user_registration', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_user_registration_user_id'))
batch_op.drop_index(batch_op.f('ix_user_registration_status'))
op.drop_table('user_registration')
# ### end Alembic commands ###