c5738d269b
LST-58 (2.4), part 1/2 — Client move. Prospect + repertoire front are pending the product spec and will be added on this branch afterward. - Client entity moved to src/Module/Directory/Domain/Entity; repository split into Domain/Repository/ClientRepositoryInterface + Doctrine impl (bound in services.yaml). 5 client MCP tools moved to Infrastructure/Mcp/Tool, now injecting the interface. - resolve_target_entities ClientInterface repointed to Directory\Client; Directory mapping added; DirectoryModule registered (id directory, 2 RBAC perms). Client.projects relation now uses ProjectInterface -> Directory no longer depends on ProjectManagement. - ProjectManagement Create/UpdateProjectTool inject Directory's ClientRepositoryInterface; Serializer and fixtures repointed. - Garde-fous: #[Auditable] + Timestampable/Blamable on Client (additive migration: created_at/updated_at + created_by/updated_by FK ON DELETE SET NULL + COMMENT). 161 tests green, mapping valid, no API route regression, cs-fixer clean.
54 lines
2.7 KiB
PHP
54 lines
2.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DoctrineMigrations;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
/**
|
|
* Directory module: add Timestampable/Blamable columns to client.
|
|
*
|
|
* Client (moved to App\Module\Directory\Domain\Entity) adopts
|
|
* TimestampableBlamableTrait. This migration is purely additive — nullable
|
|
* columns + nullable FK to "user" with ON DELETE SET NULL. No DROP/ALTER on
|
|
* existing data. Columns are lowercase snake_case. Hand-written to guarantee
|
|
* zero destructive instruction.
|
|
*/
|
|
final class Version20260620180000 extends AbstractMigration
|
|
{
|
|
public function getDescription(): string
|
|
{
|
|
return 'Directory: add timestampable/blamable columns to client (additive)';
|
|
}
|
|
|
|
public function up(Schema $schema): void
|
|
{
|
|
$this->addSql('ALTER TABLE client ADD created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
|
$this->addSql('ALTER TABLE client ADD updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
|
$this->addSql('ALTER TABLE client ADD created_by INT DEFAULT NULL');
|
|
$this->addSql('ALTER TABLE client ADD updated_by INT DEFAULT NULL');
|
|
$this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C7440455DE12AB56 FOREIGN KEY (created_by) REFERENCES "user" (id) ON DELETE SET NULL NOT DEFERRABLE');
|
|
$this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C744045516FE72E1 FOREIGN KEY (updated_by) REFERENCES "user" (id) ON DELETE SET NULL NOT DEFERRABLE');
|
|
$this->addSql('CREATE INDEX IDX_C7440455DE12AB56 ON client (created_by)');
|
|
$this->addSql('CREATE INDEX IDX_C744045516FE72E1 ON client (updated_by)');
|
|
$this->addSql("COMMENT ON COLUMN client.created_at IS 'Creation timestamp (Timestampable, set on prePersist)'");
|
|
$this->addSql("COMMENT ON COLUMN client.updated_at IS 'Last update timestamp (Timestampable, set on prePersist/preUpdate)'");
|
|
$this->addSql("COMMENT ON COLUMN client.created_by IS 'User who created the entry (Blamable, FK user.id, SET NULL on delete)'");
|
|
$this->addSql("COMMENT ON COLUMN client.updated_by IS 'User who last updated the entry (Blamable, FK user.id, SET NULL on delete)'");
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$this->addSql('ALTER TABLE client DROP CONSTRAINT FK_C7440455DE12AB56');
|
|
$this->addSql('ALTER TABLE client DROP CONSTRAINT FK_C744045516FE72E1');
|
|
$this->addSql('DROP INDEX IDX_C7440455DE12AB56');
|
|
$this->addSql('DROP INDEX IDX_C744045516FE72E1');
|
|
$this->addSql('ALTER TABLE client DROP created_at');
|
|
$this->addSql('ALTER TABLE client DROP updated_at');
|
|
$this->addSql('ALTER TABLE client DROP created_by');
|
|
$this->addSql('ALTER TABLE client DROP updated_by');
|
|
}
|
|
}
|