Fixing nullables in models

This commit is contained in:
Cayo Puigdefabregas 2021-08-04 18:15:15 +02:00
parent 710e61fca8
commit eed117808c
3 changed files with 4 additions and 3 deletions

View file

@ -70,7 +70,7 @@ def upgrade():
# DataWipe table
op.create_table('data_wipe',
sa.Column('document_id', sa.BigInteger(), nullable=True),
sa.Column('document_id', sa.BigInteger(), nullable=False),
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.ForeignKeyConstraint(['document_id'], [f'{get_inv()}.document.id'], ),
sa.ForeignKeyConstraint(['id'], [f'{get_inv()}.action.id'], ),

View file

@ -20,7 +20,7 @@ class Document(Thing):
date = Column(db.DateTime, nullable=True)
date.comment = """The date of document, some documents need to have one date
"""
id_document = Column(CIText(), nullable=False)
id_document = Column(CIText(), nullable=True)
id_document.comment = """The id of one document like invoice so they can be linked."""
owner_id = db.Column(UUID(as_uuid=True),
db.ForeignKey(User.id),
@ -48,7 +48,7 @@ class JoinedTableMixin:
class DataWipeDocument(JoinedTableMixin, Document):
"""This represent a generic document."""
software = Column(CIText(), nullable=False)
software = Column(CIText(), nullable=True)
software.comment = """Which software is used"""
success = Column(Boolean)
success.comment = """If the erase was success"""

View file

@ -15,6 +15,7 @@ class DataWipeDocument(Thing):
required=False,
description=m.DataWipeDocument.date.comment)
id_document = SanitizedStr(data_key='documentId',
required=False,
default='',
description=m.DataWipeDocument.id_document.comment)
file_name = SanitizedStr(data_key='filename',