foxnouns/alembic/versions/1710946859_add_members.py

41 lines
1.4 KiB
Python

"""Add members
Revision ID: 17cc8cb77be5
Revises: 1d8f8443a7f5
Create Date: 2024-03-20 16:00:59.251354
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '17cc8cb77be5'
down_revision: Union[str, None] = '1d8f8443a7f5'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('members',
sa.Column('id', sa.BigInteger(), nullable=False),
sa.Column('name', sa.Text(), nullable=False),
sa.Column('display_name', sa.Text(), nullable=True),
sa.Column('bio', sa.Text(), nullable=True),
sa.Column('names', postgresql.JSONB(astext_type=sa.Text()), nullable=False),
sa.Column('pronouns', postgresql.JSONB(astext_type=sa.Text()), nullable=False),
sa.Column('fields', postgresql.JSONB(astext_type=sa.Text()), nullable=False),
sa.Column('user_id', sa.BigInteger(), nullable=False),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('members')
# ### end Alembic commands ###