From 78fe03447629f01618acbfefa5994030bb45eda5 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Mon, 26 Oct 2026 10:19:38 +0000 Subject: [PATCH] fix(cli): schema honours --key-type (0.1.2) Found adopting rssamplifier.com: the flag was parsed but never passed to schemaSql, so text-keyed apps got uuid DDL. README now says hand-written adapters get ? placeholders and libSQL-shaped Postgres wrappers need dialect: "postgres". Co-Authored-By: Claude Opus 5.5 --- README.md | 2 ++ package-lock.json | 4 ++-- package.json | 2 +- src/cli.js | 16 ++++++++++++---- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ab7dbc2..9bfe29e 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,8 @@ for await (const p of profiles.all()) { ... } await profiles.remove(userId); ``` +A hand-written adapter is `{ dialect: "postgres" | "sqlite", query(text, params) }` and receives `?` placeholders. A Postgres client wrapped to look like `@libsql/client` (anything with `execute()` that is not `@profullstack/libsql-pg`) is taken for SQLite: pass `dialect: "postgres"`. + There is no foreign key to a users table: the host's may be named anything or live elsewhere. Deleting a user is the host's job, so call `remove()` there. ## CLI and MCP diff --git a/package-lock.json b/package-lock.json index d82b4dc..d813b80 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@profullstack/profile", - "version": "0.1.1", + "version": "0.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@profullstack/profile", - "version": "0.1.1", + "version": "0.1.2", "license": "MIT", "bin": { "profile": "src/cli.js" diff --git a/package.json b/package.json index 6841bd7..5b354a6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@profullstack/profile", - "version": "0.1.1", + "version": "0.1.2", "type": "module", "description": "One user profile for every property: email, first_name, last_name, company_domain, job_title, linkedin_url. Validation, signup form fields, storage on Postgres/Turso/Supabase, HTTP handlers, CSV export, CLI and MCP.", "keywords": [ diff --git a/src/cli.js b/src/cli.js index 259d418..5715950 100644 --- a/src/cli.js +++ b/src/cli.js @@ -20,12 +20,13 @@ import { csvRow, } from "./index.js"; -const VERSION = "0.1.1"; +const VERSION = "0.1.2"; const USAGE = `profile - signup profile fields (${COLUMNS.join(", ")}) profile migrate create the table, or add missing columns - profile schema [--dialect sqlite] print the DDL for a migration file + profile schema [--dialect sqlite] [--key-type text] + print the DDL for a migration file profile get one profile profile find look a profile up by email profile set --first-name Ada --company-domain acme.com ... @@ -60,7 +61,7 @@ function parseArgs(argv) { /** Flags named like the fields (or their aliases) become a profile input. */ function fieldFlags(flags) { - const skip = new Set(["table", "key", "format", "out", "since", "complete", "dialect", "help", "json"]); + const skip = new Set(["table", "key", "key_type", "format", "out", "since", "complete", "dialect", "help", "json"]); return Object.fromEntries(Object.entries(flags).filter(([k]) => !skip.has(k))); } @@ -239,7 +240,14 @@ if (cmd === "mcp") { process.exit(0); } if (cmd === "schema") { - print(schemaSql({ dialect: flags.dialect === "sqlite" ? "sqlite" : "postgres", table: flags.table, key: flags.key })); + print( + schemaSql({ + dialect: flags.dialect === "sqlite" ? "sqlite" : "postgres", + table: flags.table, + key: flags.key, + keyType: flags.key_type, + }), + ); process.exit(0); } if (cmd === "check") {