-- Tabela de documentos de empresas (licença sanitária, etc.)
CREATE TABLE IF NOT EXISTS company_documents (
  id           UUID        PRIMARY KEY DEFAULT gen_random_uuid(),
  company_id   UUID        NOT NULL REFERENCES companies(id) ON DELETE CASCADE,
  document_type TEXT       NOT NULL DEFAULT 'license',
  filename     TEXT        NOT NULL,
  file_url     TEXT        NOT NULL,
  uploaded_at  TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE INDEX IF NOT EXISTS idx_company_documents_company_id ON company_documents(company_id);
