Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: replace URLType with Text #13899

Merged
merged 2 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion requirements/lint.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ types-pytz
types-redis
types-requests
types-setuptools
types-sqlalchemy-utils
types-stdlib-list
types-stripe
4 changes: 0 additions & 4 deletions requirements/lint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,6 @@ types-setuptools==67.8.0.0 \
--hash=sha256:6df73340d96b238a4188b7b7668814b37e8018168aef1eef94a3b1872e3f60ff \
--hash=sha256:95c9ed61871d6c0e258433373a4e1753c0a7c3627a46f4d4058c7b5a08ab844f
# via -r requirements/lint.in
types-sqlalchemy-utils==1.0.1 \
--hash=sha256:37016333faa0abab7d253805ecf9f605c24ea107b32dd3643014efb8e49be76d \
--hash=sha256:95bc90db15ec4af5b13d64f04a7d31a7e851931250419fc7859354644ab3ea98
# via -r requirements/lint.in
types-stdlib-list==0.8.3.2 \
--hash=sha256:17ff97316d88257f9b775b4dea2e9ad617325ea66a2737d841946dfd42363470 \
--hash=sha256:8ed25c53c2df44212cbfd0ea3b4cc63d7ec0c13f5c475b6004e83c69fcd3f15c
Expand Down
1 change: 0 additions & 1 deletion requirements/main.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ sentry-sdk
setuptools
sqlalchemy[asyncio]>=0.9,<1.5.0 # https://github.com/pypi/warehouse/pull/9228
sqlalchemy-citext
sqlalchemy-utils
stdlib-list
stripe
structlog
Expand Down
5 changes: 0 additions & 5 deletions requirements/main.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1453,15 +1453,10 @@ sqlalchemy[asyncio]==1.4.48 \
# alembic
# paginate-sqlalchemy
# sqlalchemy-citext
# sqlalchemy-utils
# zope-sqlalchemy
sqlalchemy-citext==1.8.0 \
--hash=sha256:a1740e693a9a334e7c8f60ae731083fe75ce6c1605bb9ca6644a6f1f63b15b77
# via -r requirements/main.in
sqlalchemy-utils==0.41.1 \
--hash=sha256:6c96b0768ea3f15c0dc56b363d386138c562752b84f647fb8d31a2223aaab801 \
--hash=sha256:a2181bff01eeb84479e38571d2c0718eb52042f9afd8c194d0d02877e84b7d74
# via -r requirements/main.in
stdlib-list==0.8.0 \
--hash=sha256:2ae0712a55b68f3fbbc9e58d6fa1b646a062188f49745b495f94d3310a9fdd3e \
--hash=sha256:a1e503719720d71e2ed70ed809b385c60cd3fb555ba7ec046b96360d30b16d9f
Expand Down
3 changes: 1 addition & 2 deletions warehouse/banners/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from datetime import date

from sqlalchemy import Boolean, Column, Date, String, Text
from sqlalchemy_utils.types.url import URLType

from warehouse import db
from warehouse.utils.attrs import make_repr
Expand All @@ -29,7 +28,7 @@ class Banner(db.Model):

# banner display configuration
text = Column(Text, nullable=False)
link_url = Column(URLType, nullable=False)
link_url = Column(Text, nullable=False)
link_label = Column(String, nullable=False, default=DEFAULT_BTN_LABEL)
fa_icon = Column(String, nullable=False, default=DEFAULT_FA_ICON)

Expand Down
2 changes: 0 additions & 2 deletions warehouse/cli/db/dbml.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
Text,
Time,
)
from sqlalchemy_utils.types.url import URLType

import warehouse.db

Expand Down Expand Up @@ -71,7 +70,6 @@
TZDateTime: "datetime",
ARRAY: '"string[]"',
TIMESTAMP: "datetime",
URLType: "varchar",
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"""

import sqlalchemy as sa
import sqlalchemy_utils

from alembic import op
from sqlalchemy.dialects import postgresql
Expand Down Expand Up @@ -48,7 +47,7 @@ def upgrade():
),
sa.Column("name", sa.String(), nullable=False),
sa.Column("text", sa.Text(), nullable=False),
sa.Column("link_url", sqlalchemy_utils.types.url.URLType(), nullable=False),
sa.Column("link_url", sa.Text(), nullable=False),
sa.Column("link_label", sa.String(), nullable=False),
sa.Column("fa_icon", sa.String(), nullable=False),
sa.Column("active", sa.Boolean(), nullable=False),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"""

import sqlalchemy as sa
import sqlalchemy_utils.types.url

from alembic import op
from sqlalchemy.dialects import postgresql
Expand Down Expand Up @@ -50,7 +49,7 @@ def upgrade():
),
sa.Column(
"link_url",
sqlalchemy_utils.types.url.URLType(),
sa.Text(),
nullable=False,
comment="External URL associated with the organization",
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"""

import sqlalchemy as sa
import sqlalchemy_utils

from alembic import op
from sqlalchemy.dialects import postgresql
Expand Down Expand Up @@ -49,7 +48,7 @@ def upgrade():
sa.Column("name", sa.Text(), nullable=False),
sa.Column("display_name", sa.Text(), nullable=False),
sa.Column("orgtype", sa.Text(), nullable=False),
sa.Column("link_url", sqlalchemy_utils.types.url.URLType(), nullable=False),
sa.Column("link_url", sa.Text(), nullable=False),
sa.Column("description", sa.Text(), nullable=False),
sa.Column(
"is_active", sa.Boolean(), nullable=False, server_default=sa.sql.false()
Expand Down
11 changes: 3 additions & 8 deletions warehouse/migrations/versions/d0c22553b338_sponsor_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"""

import sqlalchemy as sa
import sqlalchemy_utils

from alembic import op
from sqlalchemy.dialects import postgresql
Expand Down Expand Up @@ -49,13 +48,9 @@ def upgrade():
sa.Column("name", sa.String(), nullable=False),
sa.Column("service", sa.String(), nullable=True),
sa.Column("activity_markdown", sa.Text(), nullable=True),
sa.Column("link_url", sqlalchemy_utils.types.url.URLType(), nullable=False),
sa.Column(
"color_logo_url", sqlalchemy_utils.types.url.URLType(), nullable=False
),
sa.Column(
"white_logo_url", sqlalchemy_utils.types.url.URLType(), nullable=True
),
sa.Column("link_url", sa.Text(), nullable=False),
sa.Column("color_logo_url", sa.Text(), nullable=False),
sa.Column("white_logo_url", sa.Text(), nullable=True),
sa.Column("is_active", sa.Boolean(), nullable=False),
sa.Column("footer", sa.Boolean(), nullable=False),
sa.Column("psf_sponsor", sa.Boolean(), nullable=False),
Expand Down
3 changes: 1 addition & 2 deletions warehouse/organizations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.exc import NoResultFound
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy_utils.types.url import URLType

from warehouse import db
from warehouse.accounts.models import User
Expand Down Expand Up @@ -243,7 +242,7 @@ def normalized_name(cls): # noqa: N805
comment="What type of organization such as Community or Company",
)
link_url = Column(
URLType, nullable=False, comment="External URL associated with the organization"
Text, nullable=False, comment="External URL associated with the organization"
)
description = Column(
Text,
Expand Down
7 changes: 3 additions & 4 deletions warehouse/sponsors/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# limitations under the License.

from sqlalchemy import Boolean, Column, Integer, String, Text
from sqlalchemy_utils.types.url import URLType

from warehouse import db
from warehouse.utils import readme
Expand All @@ -26,9 +25,9 @@ class Sponsor(db.Model):
service = Column(String)
activity_markdown = Column(Text)

link_url = Column(URLType, nullable=False)
color_logo_url = Column(URLType, nullable=False)
white_logo_url = Column(URLType)
link_url = Column(Text, nullable=False)
color_logo_url = Column(Text, nullable=False)
white_logo_url = Column(Text)

# control flags
is_active = Column(Boolean, default=False, nullable=False)
Expand Down