CREATE TABLE IF NOT EXISTS tea (
  id serial PRIMARY KEY,
  tea_name VARCHAR(128) NOT NULL DEFAULT 'Unnamed Tea',
  rfid_code VARCHAR(128) NOT NULL,
  tea_notes VARCHAR(512) NOT NULL DEFAULT '',
  water_temp INT NOT NULL DEFAULT -1,
  steeping_seconds INT NOT NULL,
  registration_timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS steepinglog (
  change_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  tea_id INT NOT NULL,
  steeping_seconds INT NOT NULL,
  steeping_tested_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS config (
  default_steeping_time INT NOT NULL,
  feedback_timeout BIGINT NOT NULL
);

INSERT INTO config (default_steeping_time, feedback_timeout) VALUES (120, 60);