Skip to content

feat: create new Deployment model#144

Merged
jirhiker merged 8 commits into
stagingfrom
deployment_model
Sep 24, 2025
Merged

feat: create new Deployment model#144
jirhiker merged 8 commits into
stagingfrom
deployment_model

Conversation

@ksmuczynski
Copy link
Copy Markdown
Contributor

Why

This PR addresses the following problem / context:

  • Create new Deployment table to manage the many-to-many relationship between Things and Sensors.
  • Allows the storage of a complete, auditable history of which specific piece of physical hardware (Sensor) was installed at which Thing and for what period of time.

How

Implementation summary - the following was changed / added / removed:

  • Create Deployment model and populate with appropriate fields and relationships.

Notes

Any special considerations, workarounds, or follow-up work to note?

  • This PR addresses the creation of the Deployment table only.
  • Related validation schema files and test files still need to be created or updated.
  • Relationships to the Deployment table still need to be defined in the core tables (Thing, Sensor).
  • Transfer script needs to be created.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Files with missing lines Coverage Δ
db/__init__.py 97.29% <100.00%> (ø)
db/deployment.py 100.00% <100.00%> (ø)
db/sensor.py 100.00% <100.00%> (ø)
db/thing.py 100.00% <100.00%> (ø)

Comment thread db/deployment.py Outdated
Comment thread db/deployment.py
Copy link
Copy Markdown
Contributor

@jacob-a-brown jacob-a-brown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot that deployments need to be imported into db/__init__.py for their mappers to be configured and for them to be found/mapped in the DB. This can be done by adding the line

from db.deployment import *

to that file

Comment thread db/sensor.py Outdated
Comment thread db/thing.py Outdated

# --- Association Proxies ---
# Proxy to directly access the Sensor deployed at this Thing.
sensor: AssociationProxy[List["Sensor"]] = association_proxy(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be named sensors since multiple sensors may be associated with a thing?

Comment thread db/deployment.py Outdated
@jirhiker jirhiker merged commit 2769b8d into staging Sep 24, 2025
3 checks passed
@ksmuczynski ksmuczynski deleted the deployment_model branch October 8, 2025 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants