mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 20:01:09 +02:00
fix(website): publish failed with uuid type error on Better-Auth ids
published_by, created_by, and space_id were declared as uuid, but Mana user + space ids are Better-Auth nanoids stored as text. The insert into website.published_snapshots raised `invalid input syntax for type uuid` and Hono swallowed it as a generic 500. Changes: - schema.ts: uuid -> text on the three columns - 0003_fix_id_types.sql: ALTER COLUMN on existing installs - publish.ts: replace UUID regex on X-Mana-Space with a nanoid-shaped check (it was silently nulling valid space ids) - publish.ts: log + return the actual error message on the 500 path so the next unhandled failure is visible instead of opaque Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
645993db01
commit
c404db5b6e
3 changed files with 31 additions and 6 deletions
18
apps/api/drizzle/website/0003_fix_id_types.sql
Normal file
18
apps/api/drizzle/website/0003_fix_id_types.sql
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
-- Website module — fix id column types.
|
||||
--
|
||||
-- `published_by`, `created_by`, and `space_id` were originally declared
|
||||
-- as `uuid`, but Mana user ids (auth.users.id) and space ids
|
||||
-- (auth.organizations.id) are Better-Auth nanoids stored as `text`.
|
||||
-- Publishing failed with `invalid input syntax for type uuid`.
|
||||
--
|
||||
-- Apply with:
|
||||
-- psql "$DATABASE_URL" -f apps/api/drizzle/website/0003_fix_id_types.sql
|
||||
|
||||
ALTER TABLE "website"."published_snapshots"
|
||||
ALTER COLUMN "published_by" TYPE text;
|
||||
|
||||
ALTER TABLE "website"."published_snapshots"
|
||||
ALTER COLUMN "space_id" TYPE text;
|
||||
|
||||
ALTER TABLE "website"."custom_domains"
|
||||
ALTER COLUMN "created_by" TYPE text;
|
||||
Loading…
Add table
Add a link
Reference in a new issue