Skip to content

Commit

Permalink
Prevent integer overflows for file/AIP sizes (#346)
Browse files Browse the repository at this point in the history
When storing AIP and file size values, and using MySQL as the database,
file size values larger than 2GB were being stored only as 2GB. This
changes the SQLalchemy integer type, used for this data, so sizes will
be stored correctly.
  • Loading branch information
mcantelon committed Nov 25, 2024
1 parent 49b0478 commit 6256b74
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions AIPscan/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ class AIP(db.Model):
transfer_name = db.Column(db.String(255))
create_date = db.Column(db.DateTime(), index=True)
mets_sha256 = db.Column(db.String(64))
size = db.Column(db.Integer())
size = db.Column(db.BigInteger())
storage_service_id = db.Column(
db.Integer(), db.ForeignKey("storage_service.id"), nullable=False
)
Expand Down Expand Up @@ -388,7 +388,7 @@ class File(db.Model):
filepath = db.Column(db.Text(), nullable=True) # Accommodate long filepaths.
uuid = db.Column(db.String(255), index=True)
file_type = db.Column(db.Enum(FileType))
size = db.Column(db.Integer())
size = db.Column(db.BigInteger())
# Date created maps to PREMIS dateCreatedByApplication for original
# files, which in practice is almost always date last modified, and
# to normalization date for preservation files.
Expand Down

0 comments on commit 6256b74

Please sign in to comment.