FastAPI + SQLAlchemy/Alembic + MariaDB backend with Jinja2/htmx/Alpine server-rendered frontend. Multi-user via Google OAuth, daily habit tracking, monthly/weekly history views, Web Push reminders via APScheduler, and PWA support (manifest, service worker, offline caching). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
"""add user table
|
|
|
|
Revision ID: 0003_add_user_table
|
|
Revises: 0002_add_condition_text
|
|
Create Date: 2026-07-15
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision: str = "0003_add_user_table"
|
|
down_revision: Union[str, None] = "0002_add_condition_text"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"user",
|
|
sa.Column("id", sa.Integer(), primary_key=True, autoincrement=True),
|
|
sa.Column("google_sub", sa.String(length=255), nullable=False, unique=True),
|
|
sa.Column("email", sa.String(length=255), nullable=False, unique=True),
|
|
sa.Column("name", sa.String(length=255), nullable=True),
|
|
sa.Column("picture_url", sa.String(length=512), nullable=True),
|
|
sa.Column("created_at", sa.DateTime(), nullable=False, server_default=sa.func.now()),
|
|
mysql_engine="InnoDB",
|
|
mysql_charset="utf8mb4",
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_table("user")
|