Skip to content

Commit

Permalink
[DOP-22585] change column type from str to jsonb
Browse files Browse the repository at this point in the history
  • Loading branch information
TiGrib authored Jan 22, 2025
1 parent 14a4931 commit b710276
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ repos:
args: [--autofix, --indent, '2', --offset, '2']

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.0
hooks:
- id: codespell
args: [-w]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects.postgresql import TSTZRANGE, ExcludeConstraint
from sqlalchemy.dialects.postgresql import JSONB, TSTZRANGE, ExcludeConstraint

# revision identifiers, used by Alembic.
revision = "56f5a3f9442a"
Expand All @@ -26,7 +26,7 @@ def upgrade() -> None:
sa.Column("id", sa.BigInteger(), nullable=False),
sa.Column("user_id", sa.BigInteger, nullable=False),
sa.Column("property_id", sa.BigInteger, nullable=False),
sa.Column("value", sa.String, nullable=False),
sa.Column("value", JSONB, nullable=False),
sa.Column(
"during",
TSTZRANGE,
Expand Down
8 changes: 4 additions & 4 deletions data_rentgen/db/models/custom_user_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations

from sqlalchemy import BigInteger, ForeignKey, String, text
from sqlalchemy.dialects.postgresql import TSTZRANGE, ExcludeConstraint
from sqlalchemy import BigInteger, ForeignKey, text
from sqlalchemy.dialects.postgresql import JSONB, TSTZRANGE, ExcludeConstraint
from sqlalchemy.orm import Mapped, mapped_column

from data_rentgen.db.models.base import Base
Expand Down Expand Up @@ -38,8 +38,8 @@ class CustomUserProperties(Base):
doc="Id of user's custom property",
)

value: Mapped[str] = mapped_column(
String,
value: Mapped[JSONB] = mapped_column(
JSONB,
nullable=False,
)

Expand Down

0 comments on commit b710276

Please sign in to comment.