CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

CREATE TABLE IF NOT EXISTS Certificates
  ( id         UUID         PRIMARY KEY DEFAULT uuid_generate_v1mc()
  , domain     VARCHAR(256) NOT NULL
  , data       TEXT         NOT NULL
  , created_at TIMESTAMP    NOT NULL DEFAULT NOW()
  , edited_at  TIMESTAMP    NOT NULL DEFAULT NOW()
  , active     BOOLEAN      NOT NULL DEFAULT true
  );

CREATE UNIQUE INDEX IF NOT EXISTS Certificates_domain ON Certificates (domain);
