<?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 Version20251001175941 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add createdBy field to SalesJob entity to track who created the job';
}
public function up(Schema $schema): void
{
// Add created_by_id column to sales_job table
$this->addSql('ALTER TABLE sales_job ADD created_by_id INT DEFAULT NULL');
$this->addSql('CREATE INDEX IDX_ECC4FE2B03A8386 ON sales_job (created_by_id)');
$this->addSql('ALTER TABLE sales_job ADD CONSTRAINT FK_ECC4FE2B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id) ON DELETE SET NULL');
}
public function down(Schema $schema): void
{
// Remove created_by_id column from sales_job table
$this->addSql('ALTER TABLE sales_job DROP FOREIGN KEY FK_ECC4FE2B03A8386');
$this->addSql('DROP INDEX IDX_ECC4FE2B03A8386 ON sales_job');
$this->addSql('ALTER TABLE sales_job DROP created_by_id');
}
}