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
Organizations & Users
| Table | Purpose |
|---|---|
organizations | Organizations are the top-level tenant in Scanopy. |
users | Users belong to organizations and have role-based permissions. |
invites | Invitations for new users to join an organization. |
user_api_keys | User API keys for programmatic access. |
Network Infrastructure
| Table | Purpose |
|---|---|
networks | Networks are logical containers for discovered infrastructure. |
hosts | Network hosts (devices). |
subnets | Network subnets define IP address ranges. |
interfaces | Network interfaces on hosts. |
ports | Open ports on network hosts. |
services | Services running on hosts. |
bindings | Bindings link services to interfaces and ports. |
if_entries | SNMP interface entries from device discovery. |
Discovery & Daemons
| Table | Purpose |
|---|---|
daemons | Discovery daemons that scan your network. |
api_keys | API keys for daemon authentication. |
discovery | Network discovery sessions. |
snmp_credentials | SNMP credentials for network device discovery. |
Visualization
| Table | Purpose |
|---|---|
groups | Service groups for organizing topology views. |
topologies | Network topology views and layouts. |
shares | Shared topology links for external access. |
Metadata
| Table | Purpose |
|---|---|
tags | Tags for categorizing entities. |
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).
Network Isolation
All discovery data is scoped to a network:
- Hosts, subnets, services, interfaces, ports, and bindings all have a
network_idforeign key - Networks belong to organizations
- Users are granted access to specific networks via
user_network_access
Cascade Deletes
Most foreign keys use ON DELETE CASCADE:
- Deleting an organization removes all its networks, users, and tags
- Deleting a network removes all hosts, services, subnets, and discovery data
- Deleting a host removes all its interfaces, ports, and services
Full Schema Reference
For the complete schema with all columns and types, see the detailed ER diagram below. Use the zoom controls or fullscreen mode to explore.