- Npc gains self-referencing father/mother (nullable, ON DELETE SET NULL); editable as dropdowns on the per-NPC form - app:npc:link-parents parses "son/daughter/child of X [and Y]" from the Relationships / Notes column, resolves the names within the same family, and works out which parent is father vs mother from husband/wife/widow(er) and son/daughter/sister/brother cues (plus a small name-gender table for the few the text can't disambiguate). --dry-run / --force. 92/180 linked, none ambiguous. - migrations now pin ENGINE=InnoDB - the local WAMP MariaDB defaults to MyISAM, which silently drops foreign keys Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
38 lines
1.4 KiB
PHP
38 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DoctrineMigrations;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
/**
|
|
* Auto-generated Migration: Please modify to your needs!
|
|
*/
|
|
final class Version20260906131635 extends AbstractMigration
|
|
{
|
|
public function getDescription(): string
|
|
{
|
|
return 'Add self-referencing father_id / mother_id to npc';
|
|
}
|
|
|
|
public function up(Schema $schema): void
|
|
{
|
|
$this->addSql('ALTER TABLE npc ADD father_id INT DEFAULT NULL, ADD mother_id INT DEFAULT NULL');
|
|
$this->addSql('ALTER TABLE npc ADD CONSTRAINT FK_468C762C2055B9A2 FOREIGN KEY (father_id) REFERENCES npc (id) ON DELETE SET NULL');
|
|
$this->addSql('ALTER TABLE npc ADD CONSTRAINT FK_468C762CB78A354D FOREIGN KEY (mother_id) REFERENCES npc (id) ON DELETE SET NULL');
|
|
$this->addSql('CREATE INDEX IDX_468C762C2055B9A2 ON npc (father_id)');
|
|
$this->addSql('CREATE INDEX IDX_468C762CB78A354D ON npc (mother_id)');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$this->addSql('ALTER TABLE npc DROP FOREIGN KEY FK_468C762C2055B9A2');
|
|
$this->addSql('ALTER TABLE npc DROP FOREIGN KEY FK_468C762CB78A354D');
|
|
$this->addSql('DROP INDEX IDX_468C762C2055B9A2 ON npc');
|
|
$this->addSql('DROP INDEX IDX_468C762CB78A354D ON npc');
|
|
$this->addSql('ALTER TABLE npc DROP father_id, DROP mother_id');
|
|
}
|
|
}
|