Fresh history cut from cynarAI/evoo antigravity-handoff/project-timeline (Voice First + project timeline). Brand docs/titles as evOo; keep @rakazo/* packages as tech debt. Excludes node_modules, caches, secrets, voice blobs.
16 lines
366 B
SQL
16 lines
366 B
SQL
ALTER TABLE "bots" ADD COLUMN "position" INTEGER NOT NULL DEFAULT 0;
|
|
|
|
WITH ranked AS (
|
|
SELECT
|
|
"id",
|
|
ROW_NUMBER() OVER (
|
|
PARTITION BY "workspaceId", "userId"
|
|
ORDER BY "updatedAt" DESC, "createdAt" ASC, "id" ASC
|
|
) - 1 AS "position"
|
|
FROM "bots"
|
|
)
|
|
UPDATE "bots"
|
|
SET "position" = ranked."position"
|
|
FROM ranked
|
|
WHERE "bots"."id" = ranked."id";
|