| 1 | """Add Google OAuth2 SSO fields to sso_config table. |
| 2 | |
| 3 | Revision ID: b2c3d4e5f6a7 |
| 4 | Revises: a1b2c3d4e5f6 |
| 5 | Create Date: 2026-03-23 00:00:00.000000 |
| 6 | """ |
| 7 | |
| 8 | import sqlalchemy as sa |
| 9 | |
| 10 | from alembic import op |
| 11 | |
| 12 | # revision identifiers, used by Alembic. |
| 13 | revision = "b2c3d4e5f6a7" |
| 14 | down_revision = "a1b2c3d4e5f6" |
| 15 | branch_labels = None |
| 16 | depends_on = None |
| 17 | |
| 18 | |
| 19 | def upgrade() -> None: |
| 20 | op.add_column("sso_config", sa.Column("google_enabled", sa.Boolean(), nullable=False, server_default="0")) |
| 21 | op.add_column("sso_config", sa.Column("google_client_id", sa.String(256), nullable=True)) |
| 22 | op.add_column("sso_config", sa.Column("google_client_secret", sa.String(512), nullable=True)) |
| 23 | op.add_column("sso_config", sa.Column("google_redirect_uri", sa.String(512), nullable=True)) |
| 24 | |
| 25 | |
| 26 | def downgrade() -> None: |
| 27 | op.drop_column("sso_config", "google_redirect_uri") |
| 28 | op.drop_column("sso_config", "google_client_secret") |
| 29 | op.drop_column("sso_config", "google_client_id") |
| 30 | op.drop_column("sso_config", "google_enabled") |