2024-03-20 16:26:00 +01:00
|
|
|
"""Add names/pronouns/fields
|
|
|
|
|
|
|
|
Revision ID: 1d8f8443a7f5
|
|
|
|
Revises: 0b63f7c8ab96
|
|
|
|
Create Date: 2024-03-20 15:36:08.756635
|
|
|
|
|
|
|
|
"""
|
2024-03-23 01:39:08 +01:00
|
|
|
|
2024-03-20 16:26:00 +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
|
|
|
|
|
2024-03-20 16:26:00 +01:00
|
|
|
# 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")
|