Skip to content

Commit

Permalink
models: drop unique user constraint for record quotas
Browse files Browse the repository at this point in the history
  • Loading branch information
slint committed Mar 14, 2024
1 parent 23159bb commit 32eba0f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# This file is part of Invenio.
# Copyright (C) 2016-2024 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

"""Remove user unique constraint from record quotas."""

from alembic import op

# revision identifiers, used by Alembic.
revision = "82e1b238acca"
down_revision = "ff9bec971d30"
branch_labels = ()
depends_on = None


def upgrade():
"""Upgrade database."""
op.drop_constraint(
"uq_rdm_records_quota_user_id", "rdm_records_quota", type_="unique"
)


def downgrade():
"""Downgrade database."""
op.create_unique_constraint(
"uq_rdm_records_quota_user_id", "rdm_records_quota", ["user_id"]
)
2 changes: 1 addition & 1 deletion invenio_rdm_records/records/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def parent_id(cls):

"""Parent record id."""

user_id = db.Column(db.Integer, unique=True)
user_id = db.Column(db.Integer)
"""User associated with the parent record via parent.access.owned_by."""

quota_size = db.Column(
Expand Down

0 comments on commit 32eba0f

Please sign in to comment.