ScanopyScanopy

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

TablePurpose
dependenciesService dependency relationships.
topologiesNetwork topology maps showing host relationships and connections.
sharesShared network views.

Key Relationships

Host → Services → Bindings

The discovery pipeline creates this hierarchy:

  1. Host — A discovered device
  2. Interface — Network interface on the host (IP + MAC)
  3. Port — Open port on the host
  4. Service — Identified service (e.g., PostgreSQL, Nginx)
  5. 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_id foreign 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.

On this page