56 lines
1.2 KiB
Python
56 lines
1.2 KiB
Python
"""Add names/pronouns/fields
|
|
|
|
Revision ID: 1d8f8443a7f5
|
|
Revises: 0b63f7c8ab96
|
|
Create Date: 2024-03-20 15:36:08.756635
|
|
|
|
"""
|
|
|
|
from typing import Sequence, Union
|
|
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
from alembic import op
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = "1d8f8443a7f5"
|
|
down_revision: Union[str, None] = "0b63f7c8ab96"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column(
|
|
"users",
|
|
sa.Column(
|
|
"names",
|
|
postgresql.JSONB(astext_type=sa.Text()),
|
|
nullable=False,
|
|
server_default="[]",
|
|
),
|
|
)
|
|
op.add_column(
|
|
"users",
|
|
sa.Column(
|
|
"pronouns",
|
|
postgresql.JSONB(astext_type=sa.Text()),
|
|
nullable=False,
|
|
server_default="[]",
|
|
),
|
|
)
|
|
op.add_column(
|
|
"users",
|
|
sa.Column(
|
|
"fields",
|
|
postgresql.JSONB(astext_type=sa.Text()),
|
|
nullable=False,
|
|
server_default="[]",
|
|
),
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_column("users", "fields")
|
|
op.drop_column("users", "pronouns")
|
|
op.drop_column("users", "names")
|