GPN BusinessDiscoverer

Documentation/ GPN BusinessDiscoverer/ gpn-yp-site-worker

D1 database schema

The gpn-user-d1 tables, their relationships, and how data flows from Places to the public site.

Article Slug: database-schema Updated: 27 Jun 2026

Storage model

The YP site worker uses a Cloudflare D1 database bound as DB (named gpn-user-d1, the shared user-facing database). D1 is SQLite at the edge — queries run inside the Worker with no network hop. The schema is defined in schema.sql at the worker root.

Tables

source_batches

Tracks each data import into the system. Every business record links back to the batch that created it.

businesses

The core business identity table. One row per business.

business_profiles

Extended profile data, one-to-one with businesses.

business_contents

Page-level content extracted from crawled websites. Many-to-one with businesses.

business_listings

Pre-computed listing cards for the search page. Many-to-one with businesses.

leads

Captured leads from the conversion flow.

Data flow

Google Places API
  -> gpn-google-places-worker (resolve, normalize)
    -> source_batches row created
    -> businesses rows inserted
      -> gpn-domain-scraper-worker (crawl websites)
        -> business_contents rows inserted
        -> business_profiles updated with extracted data
          -> business_listings rows computed for search display

The search page loader queries businesses and business_listings with joins. The detail page loader queries businesses joined to business_profiles and business_contents.

Indexes

D1 automatically indexes primary keys and unique columns. The slug and domain columns on businesses are unique-indexed for fast lookups. For full-text search, the loader currently uses LIKE queries on business_name — Vectorize will replace this with semantic search.