Files
clubber/migrations/versions/0f79356844b5_create_members_table.py
gurixandClaude 1559c48104 feat: implement GraphQL member management API
Implement complete member management system with GraphQL API per OpenSpec proposal.
Only firstName is required; all other fields are optional with conditional validation.

Key features:
- GraphQL CRUD operations (create, read, update, delete members)
- SQLAlchemy 2.0 async with SQLite database
- Alembic database migrations
- Conditional validation (email/phone validated only when provided)
- Member fields: firstName (required), lastName, address, email, phone (all optional)
- Database seed script with sample member
- FastAPI with Strawberry GraphQL integration

Implementation details:
- Python 3.11+ with uv package manager
- Async database sessions throughout
- Proper error handling and validation
- Code quality: black, isort, ruff
- Comprehensive end-to-end testing completed

All 20 tasks from OpenSpec proposal completed successfully.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 12:21:13 +01:00

58 lines
1.8 KiB
Python

"""create members table
Revision ID: 0f79356844b5
Revises:
Create Date: 2025-11-20 11:39:25.900143
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "0f79356844b5"
down_revision: Union[str, Sequence[str], None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
"""Upgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"members",
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
sa.Column("first_name", sa.String(length=100), nullable=False),
sa.Column("last_name", sa.String(length=100), nullable=True),
sa.Column("street", sa.String(length=200), nullable=True),
sa.Column("apartment_number", sa.String(length=20), nullable=True),
sa.Column("zip", sa.String(length=20), nullable=True),
sa.Column("city", sa.String(length=100), nullable=True),
sa.Column("country", sa.String(length=100), nullable=True),
sa.Column("email", sa.String(length=255), nullable=True),
sa.Column("phone", sa.String(length=50), nullable=True),
sa.Column(
"created_at",
sa.DateTime(),
server_default=sa.text("(CURRENT_TIMESTAMP)"),
nullable=False,
),
sa.Column(
"updated_at",
sa.DateTime(),
server_default=sa.text("(CURRENT_TIMESTAMP)"),
nullable=False,
),
sa.PrimaryKeyConstraint("id"),
)
# ### end Alembic commands ###
def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table("members")
# ### end Alembic commands ###