CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

CREATE TABLE company (
  id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
  name varchar(255) NOT NULL,
  website varchar(512),
  notes text
);

CREATE TABLE job_application (
  id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
  company_id uuid REFERENCES company(id) ON DELETE CASCADE,
  role varchar(255) NOT NULL,
  location varchar(255),
  applied_date date,
  status VARCHAR(50) DEFAULT 'INTERESTED',
  source varchar(255),
  job_url varchar(1024),
  salary_expectation varchar(255),
  notes text,
  last_updated timestamp DEFAULT now()
);
