1
0
Fork 0
polaris-task-force/src/migrations/20261001_000320_add_tech_tree_position.ts
Z8MB1E 15f2d0c573 feat(tech-tree): add tech-categories collection, permissions, and treePosition
Add the tech-categories collection that gives technologies a home off the
flat uncategorized pool, plus the schema support the admin editor needs.

- New `tech-categories` collection (unique name, timeline `position`,
  optional hex `color`) with a `Technologies.category` FK (ON DELETE set
  null) so deleting a category just unfiles its technologies.
- Add `Technologies.treePosition {x,y}` so the canvas can pin a node's
  manual position; clearing it uses `{x:null,y:null}`.
- Register the two hand-written migrations (tech-categories + treePosition)
  and regenerate payload-types, the drizzle schema, and the admin importMap.
- Register the `tech-categories:*` permission group and grant Intelligence
  division members admin-panel access, mirroring technologies.
2026-10-01 10:03:49 -04:00

13 lines
554 B
TypeScript

import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "technologies" ADD COLUMN "tree_position_x" numeric;
ALTER TABLE "technologies" ADD COLUMN "tree_position_y" numeric;`)
}
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "technologies" DROP COLUMN "tree_position_x";
ALTER TABLE "technologies" DROP COLUMN "tree_position_y";`)
}