Skip to content

Commit

Permalink
fix: Add unique key to combination of registry_id and group_id
Browse files Browse the repository at this point in the history
  • Loading branch information
jopemachine committed Nov 18, 2024
1 parent 6004978 commit d4ce974
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ai/backend/manager/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from . import acl as _acl
from . import agent as _agent
from . import association_container_registries_groups as _association_container_registries_groups
from . import container_registry as _container_registry
from . import domain as _domain
from . import dotfile as _dotfile
Expand Down Expand Up @@ -30,6 +31,7 @@
"metadata",
*_acl.__all__,
*_agent.__all__,
*_association_container_registries_groups.__all__,
*_container_registry.__all__,
*_domain.__all__,
*_endpoint.__all__,
Expand Down Expand Up @@ -58,6 +60,7 @@

from .acl import * # noqa
from .agent import * # noqa
from .association_container_registries_groups import * # noqa
from .container_registry import * # noqa
from .domain import * # noqa
from .dotfile import * # noqa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def upgrade() -> None:
GUID,
nullable=False,
),
sa.UniqueConstraint("registry_id", "group_id", name="uq_registry_id_group_id"),
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@

class AssociationContainerRegistriesGroupsRow(Base):
__tablename__ = "association_container_registries_groups"
__table_args__ = (
# constraint
sa.UniqueConstraint("registry_id", "group_id", name="uq_registry_id_group_id"),
)

id = IDColumn()
registry_id = sa.Column(
"registry_id",
Expand Down

0 comments on commit d4ce974

Please sign in to comment.