forked from andika/membership-be
40 lines
1.0 KiB
Python
40 lines
1.0 KiB
Python
"""add_custom_registration_data
|
|
|
|
Revision ID: 014_custom_registration
|
|
Revises: a1b2c3d4e5f6
|
|
Create Date: 2026-02-01 10:00:00.000000
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '014_custom_registration'
|
|
down_revision: Union[str, None] = 'a1b2c3d4e5f6'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# Add custom_registration_data column to users table
|
|
# This stores dynamic registration field responses as JSON
|
|
op.add_column('users', sa.Column(
|
|
'custom_registration_data',
|
|
sa.JSON,
|
|
nullable=False,
|
|
server_default='{}'
|
|
))
|
|
|
|
# Add comment for documentation
|
|
op.execute("""
|
|
COMMENT ON COLUMN users.custom_registration_data IS
|
|
'Dynamic registration field responses stored as JSON for custom form fields';
|
|
""")
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_column('users', 'custom_registration_data')
|