-- AlterTable ALTER TABLE "User" ADD COLUMN "avatar" TEXT, ADD COLUMN "firstName" TEXT, ADD COLUMN "lastName" TEXT; -- Backfill: existing accounts only have the single `name` captured at -- sign-up. Split it into firstName (first word) and lastName (the rest) so -- the Profile page starts from what the user already gave us instead of a -- blank form. Single-word names (e.g. "Cher") get firstName only. UPDATE "User" SET "firstName" = split_part("name", ' ', 1) WHERE "name" IS NOT NULL AND btrim("name") <> ''; UPDATE "User" SET "lastName" = trim(regexp_replace("name", '^\S+\s+', '')) WHERE "name" IS NOT NULL AND "name" ~ '^\S+\s+\S+';