foxnouns/alembic/versions/1710946859_add_members.py

48 lines
1.4 KiB
Python
Raw Permalink Normal View History

"""Add members
Revision ID: 17cc8cb77be5
Revises: 1d8f8443a7f5
Create Date: 2024-03-20 16:00:59.251354
"""
2024-03-23 01:39:08 +01:00
from typing import Sequence, Union
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
2024-03-23 01:39:08 +01:00
from alembic import op
# revision identifiers, used by Alembic.
2024-03-23 01:39:08 +01:00
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! ###
2024-03-23 01:39:08 +01:00
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! ###
2024-03-23 01:39:08 +01:00
op.drop_table("members")
# ### end Alembic commands ###