From cc9d1e3d3757850f047b3a37bf28fa8b2fa0b20e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 13 May 2026 18:58:38 +0000 Subject: [PATCH 1/3] Initial plan From 2682d51703f76c0cd9a106146df4391bf6dd2acd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 13 May 2026 18:59:58 +0000 Subject: [PATCH 2/3] Increase OAuth URL column lengths: update model.py and add migration Agent-Logs-Url: https://github.com/exhuma/powonline/sessions/22a63558-9cf8-432a-bd7a-231e286fa973 Co-authored-by: exhuma <65717+exhuma@users.noreply.github.com> --- .../d3e4f5a6b7c8_expand_oauth_url_columns.py | 50 +++++++++++++++++++ src/powonline/model.py | 4 +- 2 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 alembic/versions/d3e4f5a6b7c8_expand_oauth_url_columns.py diff --git a/alembic/versions/d3e4f5a6b7c8_expand_oauth_url_columns.py b/alembic/versions/d3e4f5a6b7c8_expand_oauth_url_columns.py new file mode 100644 index 0000000..e4532b6 --- /dev/null +++ b/alembic/versions/d3e4f5a6b7c8_expand_oauth_url_columns.py @@ -0,0 +1,50 @@ +"""expand-oauth-url-columns + +Increase profile_url and image_url in oauth_connection to unbounded Unicode +(TEXT) to accommodate OAuth providers that return URLs longer than 512 chars. + +Revision ID: d3e4f5a6b7c8 +Revises: c2d3e4f5a6b7 +Create Date: 2026-05-13 00:00:00.000000 + +""" + +import sqlalchemy as sa + +from alembic import op + +# revision identifiers, used by Alembic. +revision = "d3e4f5a6b7c8" +down_revision = "c2d3e4f5a6b7" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + op.alter_column( + "oauth_connection", + "profile_url", + type_=sa.Unicode(), + existing_type=sa.Unicode(512), + ) + op.alter_column( + "oauth_connection", + "image_url", + type_=sa.Unicode(), + existing_type=sa.Unicode(512), + ) + + +def downgrade() -> None: + op.alter_column( + "oauth_connection", + "image_url", + type_=sa.Unicode(512), + existing_type=sa.Unicode(), + ) + op.alter_column( + "oauth_connection", + "profile_url", + type_=sa.Unicode(512), + existing_type=sa.Unicode(), + ) diff --git a/src/powonline/model.py b/src/powonline/model.py index 0383970..1d6d2bc 100644 --- a/src/powonline/model.py +++ b/src/powonline/model.py @@ -401,8 +401,8 @@ class OauthConnection(Base, TimestampMixin): # type: ignore access_token: Mapped[str | None] = mapped_column(Unicode(255)) secret: Mapped[str | None] = mapped_column(Unicode(255)) display_name: Mapped[str | None] = mapped_column(Unicode(255)) - profile_url: Mapped[str | None] = mapped_column(Unicode(512)) - image_url: Mapped[str | None] = mapped_column(Unicode(512)) + profile_url: Mapped[str | None] = mapped_column(Unicode) + image_url: Mapped[str | None] = mapped_column(Unicode) rank: Mapped[int | None] = mapped_column() user: Mapped["User"] = relationship( From 3bad04318a49a0a5ce7e5a59c6e415b574fb0329 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 13 May 2026 19:06:16 +0000 Subject: [PATCH 3/3] Use Unicode(2048) instead of unbounded Unicode for OAuth URL columns Agent-Logs-Url: https://github.com/exhuma/powonline/sessions/8cb94a79-7063-4adb-b3b5-2ab83d3b1c81 Co-authored-by: exhuma <65717+exhuma@users.noreply.github.com> --- alembic/versions/d3e4f5a6b7c8_expand_oauth_url_columns.py | 8 ++++---- src/powonline/model.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/alembic/versions/d3e4f5a6b7c8_expand_oauth_url_columns.py b/alembic/versions/d3e4f5a6b7c8_expand_oauth_url_columns.py index e4532b6..58a0437 100644 --- a/alembic/versions/d3e4f5a6b7c8_expand_oauth_url_columns.py +++ b/alembic/versions/d3e4f5a6b7c8_expand_oauth_url_columns.py @@ -24,13 +24,13 @@ def upgrade() -> None: op.alter_column( "oauth_connection", "profile_url", - type_=sa.Unicode(), + type_=sa.Unicode(2048), existing_type=sa.Unicode(512), ) op.alter_column( "oauth_connection", "image_url", - type_=sa.Unicode(), + type_=sa.Unicode(2048), existing_type=sa.Unicode(512), ) @@ -40,11 +40,11 @@ def downgrade() -> None: "oauth_connection", "image_url", type_=sa.Unicode(512), - existing_type=sa.Unicode(), + existing_type=sa.Unicode(2048), ) op.alter_column( "oauth_connection", "profile_url", type_=sa.Unicode(512), - existing_type=sa.Unicode(), + existing_type=sa.Unicode(2048), ) diff --git a/src/powonline/model.py b/src/powonline/model.py index 1d6d2bc..6aad532 100644 --- a/src/powonline/model.py +++ b/src/powonline/model.py @@ -401,8 +401,8 @@ class OauthConnection(Base, TimestampMixin): # type: ignore access_token: Mapped[str | None] = mapped_column(Unicode(255)) secret: Mapped[str | None] = mapped_column(Unicode(255)) display_name: Mapped[str | None] = mapped_column(Unicode(255)) - profile_url: Mapped[str | None] = mapped_column(Unicode) - image_url: Mapped[str | None] = mapped_column(Unicode) + profile_url: Mapped[str | None] = mapped_column(Unicode(2048)) + image_url: Mapped[str | None] = mapped_column(Unicode(2048)) rank: Mapped[int | None] = mapped_column() user: Mapped["User"] = relationship(