CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

CREATE TABLE IF NOT EXISTS Routes
  ( id         UUID         PRIMARY KEY DEFAULT uuid_generate_v1mc()
  , creator    VARCHAR(32)  NOT NULL
  , hostname   VARCHAR(256) 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 Routes_hostname on Routes (hostname);
