diff --git a/api/migrations/schema/Version20250114202150.php b/api/migrations/schema/Version20250114202150.php new file mode 100644 index 0000000000..b06d9fc9e0 --- /dev/null +++ b/api/migrations/schema/Version20250114202150.php @@ -0,0 +1,27 @@ +addSql('ALTER TABLE checklist ADD checklistPrototypeId VARCHAR(16) DEFAULT NULL'); + } + + public function down(Schema $schema): void { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE checklist DROP checklistPrototypeId'); + } +} diff --git a/api/src/Entity/Checklist.php b/api/src/Entity/Checklist.php index 455fe17cdf..14038b16e4 100644 --- a/api/src/Entity/Checklist.php +++ b/api/src/Entity/Checklist.php @@ -115,6 +115,13 @@ class Checklist extends BaseEntity implements BelongsToCampInterface, CopyFromPr #[ORM\Column(type: 'text')] public string $name; + /** + * The id of the checklist that was used as a template for creating this checklist. Internal for now, is + * not published through the API. + */ + #[ORM\Column(type: 'string', length: 16, nullable: true)] + public ?string $checklistPrototypeId = null; + /** * Whether this checklist is a template. */ @@ -168,6 +175,8 @@ public function removeChecklistItem(ChecklistItem $checklistItem): self { public function copyFromPrototype($prototype, $entityMap): void { $entityMap->add($prototype, $this); + $this->checklistPrototypeId = $prototype->getId(); + // copy Checklist base properties $this->name ??= $prototype->name;