DROP TABLE IF EXISTS portsbuildstats CASCADE;

CREATE TABLE IF NOT EXISTS portsbuildstats (
  start    TIMESTAMP(0) WITH TIME ZONE NOT NULL,
  finished TIMESTAMP(0) WITH TIME ZONE NOT NULL,
  category TEXT NOT NULL,
  portname TEXT NOT NULL,
  flavor   TEXT     NULL DEFAULT NULL,
  pkgname  TEXT NOT NULL,

  CONSTRAINT portsbuildstats_pk PRIMARY KEY (start, finished, category, portname, pkgname),
  CONSTRAINT start_before_finished_ck CHECK (finished > start)
);

-- EOF
