feat(38-01): schema parentId + tag service CRUD + cycle detection

- Add parentId self-ref FK to tags table (ON DELETE SET NULL)
- Generate Drizzle migration 0010_yielding_random.sql
- Extend tag.service.ts with getAdminTags, getTagWithCounts, createTag, updateTag, deleteTag, isDescendant
- Add service tests (14 tests, all pass)
This commit is contained in:
2026-04-19 22:26:47 +02:00
parent c0a0aeff77
commit 8cefdf625b
4 changed files with 245 additions and 3 deletions

View File

@@ -0,0 +1,2 @@
ALTER TABLE "tags" ADD COLUMN "parent_id" integer;--> statement-breakpoint
ALTER TABLE "tags" ADD CONSTRAINT "tags_parent_id_tags_id_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."tags"("id") ON DELETE set null ON UPDATE no action;