Loading src/open_exposure_gateway/adapters/database/sql.py +25 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ from sqlalchemy.dialects.postgresql import UUID as PG_UUID from sqlalchemy.ext.asyncio import AsyncAttrs from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column from open_exposure_gateway.domain.models.deployments.enums import AppDeploymentState from open_exposure_gateway.domain.models.instances.enums import AppInstanceState from open_exposure_gateway.domain.models.operations.enums import ( OperationStatus, Loading Loading @@ -165,6 +166,27 @@ class CallbackDeliveryRow(Base): state: Mapped[str] = mapped_column(String(32), nullable=False) class AppDeploymentRow(AuditedMixin, Base): __tablename__ = "app_deployments" __table_args__ = ( Index("idx_app_deployments_operation", "operation_id"), Index("idx_app_deployments_registration", "app_registration_id"), ) app_deployment_id: Mapped[UUID] = mapped_column(PG_UUID(as_uuid=True), primary_key=True) operation_id: Mapped[UUID] = mapped_column( ForeignKey("operations.operation_id"), nullable=False ) app_registration_id: Mapped[UUID] = mapped_column( ForeignKey("app_registrations.app_registration_id"), nullable=False ) app_deployment_name: Mapped[str] = mapped_column(String(64), nullable=False) edge_cloud_zones: Mapped[list[str]] = mapped_column(JSONB, nullable=False) state: Mapped[AppDeploymentState] = mapped_column( _enum_type(AppDeploymentState), nullable=False ) class AppInstanceRow(AuditedMixin, Base): __tablename__ = "app_instances" __table_args__ = ( Loading @@ -177,9 +199,9 @@ class AppInstanceRow(AuditedMixin, Base): operation_id: Mapped[UUID] = mapped_column( ForeignKey("operations.operation_id"), nullable=False ) # No FK yet: app_deployments (multi-zone POST /deployments) is out of # scope for this MR. app_deployment_id: Mapped[UUID | None] = mapped_column(PG_UUID(as_uuid=True)) app_deployment_id: Mapped[UUID | None] = mapped_column( ForeignKey("app_deployments.app_deployment_id") ) app_registration_id: Mapped[UUID] = mapped_column( ForeignKey("app_registrations.app_registration_id"), nullable=False ) Loading Loading
src/open_exposure_gateway/adapters/database/sql.py +25 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ from sqlalchemy.dialects.postgresql import UUID as PG_UUID from sqlalchemy.ext.asyncio import AsyncAttrs from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column from open_exposure_gateway.domain.models.deployments.enums import AppDeploymentState from open_exposure_gateway.domain.models.instances.enums import AppInstanceState from open_exposure_gateway.domain.models.operations.enums import ( OperationStatus, Loading Loading @@ -165,6 +166,27 @@ class CallbackDeliveryRow(Base): state: Mapped[str] = mapped_column(String(32), nullable=False) class AppDeploymentRow(AuditedMixin, Base): __tablename__ = "app_deployments" __table_args__ = ( Index("idx_app_deployments_operation", "operation_id"), Index("idx_app_deployments_registration", "app_registration_id"), ) app_deployment_id: Mapped[UUID] = mapped_column(PG_UUID(as_uuid=True), primary_key=True) operation_id: Mapped[UUID] = mapped_column( ForeignKey("operations.operation_id"), nullable=False ) app_registration_id: Mapped[UUID] = mapped_column( ForeignKey("app_registrations.app_registration_id"), nullable=False ) app_deployment_name: Mapped[str] = mapped_column(String(64), nullable=False) edge_cloud_zones: Mapped[list[str]] = mapped_column(JSONB, nullable=False) state: Mapped[AppDeploymentState] = mapped_column( _enum_type(AppDeploymentState), nullable=False ) class AppInstanceRow(AuditedMixin, Base): __tablename__ = "app_instances" __table_args__ = ( Loading @@ -177,9 +199,9 @@ class AppInstanceRow(AuditedMixin, Base): operation_id: Mapped[UUID] = mapped_column( ForeignKey("operations.operation_id"), nullable=False ) # No FK yet: app_deployments (multi-zone POST /deployments) is out of # scope for this MR. app_deployment_id: Mapped[UUID | None] = mapped_column(PG_UUID(as_uuid=True)) app_deployment_id: Mapped[UUID | None] = mapped_column( ForeignKey("app_deployments.app_deployment_id") ) app_registration_id: Mapped[UUID] = mapped_column( ForeignKey("app_registrations.app_registration_id"), nullable=False ) Loading