From b6b5e5d29d47be5f84b22dcaf03d2d81d7bc339a Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 1 Mar 2023 18:06:41 +0100 Subject: [PATCH] fix fields string --- .../versions/8334535d56fa_add_digital_passport_dpp.py | 2 +- ereuse_devicehub/resources/did/models.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ereuse_devicehub/migrations/versions/8334535d56fa_add_digital_passport_dpp.py b/ereuse_devicehub/migrations/versions/8334535d56fa_add_digital_passport_dpp.py index 8d7d6cb6..ed12dd13 100644 --- a/ereuse_devicehub/migrations/versions/8334535d56fa_add_digital_passport_dpp.py +++ b/ereuse_devicehub/migrations/versions/8334535d56fa_add_digital_passport_dpp.py @@ -117,7 +117,7 @@ def upgrade(): ['issuer_id'], ['common.user.id'], ), - sa.Column('key', sa.Unicode(), nullable=False), + sa.Column('key', citext.CIText(), nullable=False), sa.PrimaryKeyConstraint('id'), schema=f'{get_inv()}', ) diff --git a/ereuse_devicehub/resources/did/models.py b/ereuse_devicehub/resources/did/models.py index c7209dd3..99b109a9 100644 --- a/ereuse_devicehub/resources/did/models.py +++ b/ereuse_devicehub/resources/did/models.py @@ -1,3 +1,4 @@ +from citext import CIText from flask import g from sortedcontainers import SortedSet from sqlalchemy import BigInteger, Column, ForeignKey, Sequence, Unicode @@ -25,9 +26,9 @@ class Proof(Thing): id = Column(BigInteger, Sequence('device_seq'), primary_key=True) id.comment = """The identifier of the device for this database. Used only internally for software; users should not use this.""" - documentId = Column(Unicode(STR_SM_SIZE), nullable=True) + documentId = Column(CIText(), nullable=True) documentId.comment = "is the hash of snapshot.json_wb" - documentSignature = Column(Unicode(STR_SM_SIZE), nullable=True) + documentSignature = Column(CIText(), nullable=True) documentSignature.comment = "is the snapshot.json_wb with the signature of the user" timestamp = Column(BigInteger, nullable=False) type = Column(Unicode(STR_SM_SIZE), nullable=False) @@ -78,11 +79,11 @@ class Dpp(Thing): """ id = Column(BigInteger, Sequence('device_seq'), primary_key=True) - key = Column(Unicode(STR_SM_SIZE), nullable=False) + key = Column(CIText(), nullable=False) key.comment = "chid:phid, (chid it's in device and phid it's in the snapshot)" - documentId = Column(Unicode(STR_SM_SIZE), nullable=True) + documentId = Column(CIText(), nullable=True) documentId.comment = "is the hash of snapshot.json_wb" - documentSignature = Column(Unicode(STR_SM_SIZE), nullable=True) + documentSignature = Column(CIText(), nullable=True) documentSignature.comment = "is the snapshot.json_wb with the signature of the user" timestamp = Column(BigInteger, nullable=False)