docs: schema.sql reference and DBeaver snapshot instructions

A test fails if docs/schema.sql drifts from the table server.js creates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfmHGGiYUjNcvJoyzdf
This commit is contained in:
ngqileandClaude Opus 5.5 committed 2026-12-01 11:41:56 +08:00
1 parent b20ef0a592
commit 5bb2a7343d
3 files changed
+52 -3

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
-- Lead storage for ins-landing-page (SQLite).
--
-- Reference only: server.js creates this table itself on first start (CREATE TABLE IF NOT EXISTS),
-- so nobody needs to run this file on deploy. server.test.js fails if this file and server.js
-- drift apart.
--
-- Changing the schema after go-live: CREATE TABLE IF NOT EXISTS never alters an existing table,
-- so a new column also needs an ALTER TABLE step against the live database.
CREATE TABLE IF NOT EXISTS leads (
id INTEGER PRIMARY KEY,
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP, -- UTC, 'YYYY-MM-DD HH:MM:SS'
name TEXT NOT NULL,
email TEXT NOT NULL, -- work email; free providers rejected
phone TEXT NOT NULL, -- phone / WhatsApp, as typed
company TEXT NOT NULL,
service TEXT, -- one of the form's options, or NULL
referrer TEXT, -- site the visitor came from
utm_source TEXT,
utm_medium TEXT,
utm_campaign TEXT
);