feat(pwa): move app.logicsrc.com from Turso/libSQL to Postgres via @profullstack/libsql-pg

Production reads DATABASE_URL (postgres://) through @profullstack/libsql-pg,
which keeps the @libsql/client surface; no query changed. A missing,
non-Postgres or leftover libsql:// URL fails at boot in production. Dev and
tests keep libSQL (file:/:memory:) as a devDependency. Postgres migrations in
src/migrations-pg/ (converted with libsql-pg convert-schema, same file names
so the copied _migrations ledger matches); migrate.mjs picks the dialect.
Tests run against Postgres with PWA_TEST_DATABASE_URL.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-09-25 16:25:23 +00:00
parent c535aaa32c
commit 9e16923a89
12 changed files with 507 additions and 29 deletions

View file

@ -0,0 +1,16 @@
-- Converted from SQLite by @profullstack/libsql-pg. Review every TODO before applying.
-- Types: INTEGER -> bigint, REAL -> double precision, BLOB -> bytea, BOOLEAN -> boolean,
-- DATETIME/TIMESTAMP -> timestamptz, TEXT -> text; INTEGER PRIMARY KEY -> identity.
create table if not exists cli_device_codes (
device_code_hash text PRIMARY KEY,
user_code text NOT NULL UNIQUE,
user_id text REFERENCES users(id) ON DELETE CASCADE,
name text,
status text NOT NULL DEFAULT 'pending',
created_at bigint NOT NULL,
expires_at bigint NOT NULL,
last_polled_at bigint
);
CREATE INDEX IF NOT EXISTS idx_cli_device_user_code ON cli_device_codes(user_code);