Database Schema
Entity relationship diagram and table reference for Scanopy's PostgreSQL database.
Scanopy uses PostgreSQL to store all network discovery data. This page provides an overview of the database schema and entity relationships.
Entity Relationship Diagram
Core Tables
Visualization
| Table | Purpose |
|---|---|
dependencies | Service dependency relationships. |
topologies | Network topology maps showing host relationships and connections. |
shares | Shared network views. |
Key Relationships
Host → Services → Bindings
The discovery pipeline creates this hierarchy:
- Host — A discovered device
- Interface — Network interface on the host (IP + MAC)
- Port — Open port on the host
- Service — Identified service (e.g., PostgreSQL, Nginx)
- Binding — Links a service to an interface and/or port
This structure allows a single service to be accessible on multiple interfaces (e.g., a database listening on both LAN and Docker bridge networks).
Site Isolation
All discovery data is scoped to a site:
- Hosts, subnets, services, interfaces, ports, and bindings all have a
site_idforeign key - Sites belong to organizations
- Users are granted access to specific sites via
user_site_access
Cascade Deletes
Most foreign keys use ON DELETE CASCADE:
- Deleting an organization removes all its sites, users, and tags
- Deleting a site removes all hosts, services, subnets, and discovery data
- Deleting a host removes all its interfaces, ports, and services
Full Schema Reference
The diagram below shows the complete schema with all columns and types.