-- Add parentId to Category (MySQL-safe)
ALTER TABLE `Category` ADD COLUMN `parentId` INTEGER NULL;

-- Optional index to speed up lookups
CREATE INDEX `Category_parentId_idx` ON `Category`(`parentId`);

-- Add self-referencing foreign key (no changes to other tables)
ALTER TABLE `Category`
  ADD CONSTRAINT `Category_parentId_fkey`
  FOREIGN KEY (`parentId`) REFERENCES `Category`(`id`)
  ON DELETE SET NULL ON UPDATE CASCADE;
