SNU DB

Tables (7)

AccessControl

  • id — SERIAL — Primary key — NOT NULL
  • account_id — UUID — Foreign key → Account.id — NOT NULL
  • instance_id — UUID — Foreign key → Instance.id — NOT NULL
  • granted_by — UUID — Foreign key → Account.id — NOT NULL
  • can_read — BOOLEAN — NOT NULL
  • can_write — BOOLEAN — NOT NULL
  • granted_at — TIMESTAMP — NOT NULL

AccessControlDetail

  • id (Key) — SERIAL — Primary key — NOT NULL
  • acl_id (id) — SERIAL — Foreign key → AccessControl.id — NOT NULL
  • end_date — DATE — NOT NULL
  • start_date — DATE — NOT NULL
  • data_type — TEXT — NOT NULL

Account

  • id — UUID — Primary key — NOT NULL
  • username — TEXT — NOT NULL
  • role — TEXT — NOT NULL
  • created_at — TIMESTAMP — NOT NULL

AuditLog

  • id — SERIAL — Primary key
  • account_id (id2) — UUID — Foreign key → Account.id — NOT NULL
  • action — TEXT — NOT NULL
  • target_table — TEXT — NOT NULL
  • target_id — UUID
  • detail — JSONB
  • created_at — TIMESTAMP — NOT NULL

Instance

  • id — UUID — Primary key — NOT NULL
  • parent_id — UUID — Foreign key → Instance.id
  • rfid — TEXT — NOT NULL
  • gender — TEXT — NOT NULL
  • birth_date — DATE — NOT NULL

TemperatureRecord

  • id — SERIAL — Primary key — NOT NULL
  • instance_id — UUID — Foreign key → Instance.id — NOT NULL
  • recorded_by — UUID — Foreign key → Account.id — NOT NULL
  • temperature — FLOAT — NOT NULL
  • recorded_at — TIMESTAMP — NOT NULL

TreatmentRecord

  • id — SERIAL — Primary key — NOT NULL
  • instance_id — UUID — Foreign key → Instance.id — NOT NULL
  • created_by — UUID — Foreign key → Account.id — NOT NULL
  • description — TEXT — NOT NULL
  • created_at — TIMESTAMP — NOT NULL