Skip to content

Commit

Permalink
models: remove unique constraint for file record key
Browse files Browse the repository at this point in the history
  • Loading branch information
slint committed Feb 9, 2024
1 parent 76a0dc0 commit cc333b9
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions invenio_records_resources/records/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,17 @@ def object_version(cls):
"""Object version connected to the record file."""
return db.relationship(ObjectVersion)

@declared_attr
def __table_args__(cls):
"""Table args."""
return (
# To make sure we don't have duplicate keys for record files
db.Index(
f"uidx_{cls.__tablename__}_record_id_key",
"record_id",
"key",
unique=True,
),
)
# NOTE: This seems to break SQLAlchemy-Continuum versioning. We should fix it
# though to make sure we don't have duplicate keys for record files.
# @declared_attr
# def __table_args__(cls):
# """Table args."""
# return (
# # To make sure we don't have duplicate keys for record files
# db.Index(
# f"uidx_{cls.__tablename__}_record_id_key",
# "record_id",
# "key",
# unique=True,
# ),
# )

0 comments on commit cc333b9

Please sign in to comment.