Skip to content

Commit

Permalink
Updating relations
Browse files Browse the repository at this point in the history
  • Loading branch information
akadlec committed Feb 6, 2022
1 parent 27b7e97 commit ff85bde
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions fastybird_devices_module/entities/channel.py
Expand Up @@ -88,7 +88,7 @@ class ChannelEntity(EntityCreatedMixin, EntityUpdatedMixin, Base):
col_params: Optional[Dict] = Column(JSON, name="params", nullable=True) # type: ignore[assignment]

device_id: Optional[bytes] = Column( # type: ignore[assignment] # pylint: disable=unused-private-member
BINARY(16), ForeignKey("fb_devices.device_id", ondelete="CASCADE"), name="device_id", nullable=False
BINARY(16), ForeignKey("fb_devices_module_devices.device_id", ondelete="CASCADE"), name="device_id", nullable=False
)

properties: List["ChannelPropertyEntity"] = relationship( # type: ignore[assignment]
Expand Down Expand Up @@ -242,7 +242,7 @@ class ChannelPropertyEntity(EntityCreatedMixin, EntityUpdatedMixin, PropertyMixi
col_type: str = Column(VARCHAR(20), name="property_type", nullable=False) # type: ignore[assignment]

channel_id: bytes = Column( # type: ignore[assignment] # pylint: disable=unused-private-member
BINARY(16), ForeignKey("fb_channels.channel_id"), name="channel_id", nullable=False
BINARY(16), ForeignKey("fb_devices_module_channels.channel_id"), name="channel_id", nullable=False
)

channel: ChannelEntity = relationship(ChannelEntity, back_populates="properties") # type: ignore[assignment]
Expand Down Expand Up @@ -365,7 +365,7 @@ class ChannelControlEntity(EntityCreatedMixin, EntityUpdatedMixin, Base):
col_name: str = Column(VARCHAR(100), name="control_name", nullable=False) # type: ignore[assignment]

channel_id: bytes = Column( # type: ignore[assignment] # pylint: disable=unused-private-member
BINARY(16), ForeignKey("fb_channels.channel_id", ondelete="CASCADE"), name="channel_id", nullable=False
BINARY(16), ForeignKey("fb_devices_module_channels.channel_id", ondelete="CASCADE"), name="channel_id", nullable=False
)

channel: ChannelEntity = relationship(ChannelEntity, back_populates="controls") # type: ignore[assignment]
Expand Down
2 changes: 1 addition & 1 deletion fastybird_devices_module/entities/connector.py
Expand Up @@ -221,7 +221,7 @@ class ConnectorControlEntity(EntityCreatedMixin, EntityUpdatedMixin, Base):
col_name: str = Column(VARCHAR(100), name="control_name", nullable=False) # type: ignore[assignment]

connector_id: bytes = Column( # type: ignore[assignment] # pylint: disable=unused-private-member
BINARY(16), ForeignKey("fb_connectors.connector_id", ondelete="CASCADE"), name="connector_id", nullable=False
BINARY(16), ForeignKey("fb_devices_module_connectors.connector_id", ondelete="CASCADE"), name="connector_id", nullable=False
)

connector: ConnectorEntity = relationship(ConnectorEntity, back_populates="controls") # type: ignore[assignment]
Expand Down
8 changes: 4 additions & 4 deletions fastybird_devices_module/entities/device.py
Expand Up @@ -125,10 +125,10 @@ class DeviceEntity(EntityCreatedMixin, EntityUpdatedMixin, Base): # pylint: dis
col_params: Optional[Dict] = Column(JSON, name="params", nullable=True) # type: ignore[assignment]

parent_id: Optional[bytes] = Column( # type: ignore[assignment] # pylint: disable=unused-private-member
BINARY(16), ForeignKey("fb_devices.device_id", ondelete="SET NULL"), name="parent_id", nullable=True
BINARY(16), ForeignKey("fb_devices_module_devices.device_id", ondelete="SET NULL"), name="parent_id", nullable=True
)
connector_id: Optional[bytes] = Column( # type: ignore[assignment] # pylint: disable=unused-private-member
BINARY(16), ForeignKey("fb_connectors.connector_id", ondelete="CASCADE"), name="connector_id", nullable=False
BINARY(16), ForeignKey("fb_devices_module_connectors.connector_id", ondelete="CASCADE"), name="connector_id", nullable=False
)

children: List["DeviceEntity"] = relationship( # type: ignore[assignment]
Expand Down Expand Up @@ -483,7 +483,7 @@ class DevicePropertyEntity(EntityCreatedMixin, EntityUpdatedMixin, PropertyMixin
col_type: str = Column(VARCHAR(20), name="property_type", nullable=False) # type: ignore[assignment]

device_id: bytes = Column( # type: ignore[assignment] # pylint: disable=unused-private-member
BINARY(16), ForeignKey("fb_devices.device_id"), name="device_id", nullable=False
BINARY(16), ForeignKey("fb_devices_module_devices.device_id"), name="device_id", nullable=False
)

device: DeviceEntity = relationship(DeviceEntity, back_populates="properties") # type: ignore[assignment]
Expand Down Expand Up @@ -606,7 +606,7 @@ class DeviceControlEntity(EntityCreatedMixin, EntityUpdatedMixin, Base):
col_name: str = Column(VARCHAR(100), name="control_name", nullable=False) # type: ignore[assignment]

device_id: bytes = Column( # type: ignore[assignment] # pylint: disable=unused-private-member
BINARY(16), ForeignKey("fb_devices.device_id", ondelete="CASCADE"), name="device_id", nullable=False
BINARY(16), ForeignKey("fb_devices_module_devices.device_id", ondelete="CASCADE"), name="device_id", nullable=False
)

device: DeviceEntity = relationship(DeviceEntity, back_populates="controls") # type: ignore[assignment]
Expand Down

0 comments on commit ff85bde

Please sign in to comment.