CREATE TABLE IF NOT EXISTS file_stats(
  id BIGINT PRIMARY KEY,
  num BIGINT NOT NULL,
  size_b BIGINT NOT NULL
);

CREATE TABLE IF NOT EXISTS namespace(
  id BIGINT PRIMARY KEY,
  name TEXT NOT NULL UNIQUE,
  lastseen BIGINT NOT NULL,
  allowance_time BIGINT,
  quota_kb BIGINT,
  quota_usage_kb BIGINT,
  usage_id BIGINT NOT NULL REFERENCES file_stats(Id) ON DELETE CASCADE,
  download_id BIGINT NOT NULL REFERENCES file_stats(Id) ON DELETE CASCADE,
  upload_id BIGINT NOT NULL REFERENCES file_stats(Id) ON DELETE CASCADE
 );
