CREATE TABLE diagnostics
(
  id VARCHAR(64) NOT NULL DEFAULT uuid_generate_v4(),
  user_id VARCHAR(64) NOT NULL REFERENCES users (id) ON DELETE CASCADE,
  type VARCHAR(255) NOT NULL,
  creator VARCHAR(255) NOT NULL,
  data TEXT,
  created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);

CREATE INDEX diagnostics_type_idx ON diagnostics(type);