34 lines
895 B
PHP
34 lines
895 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DoctrineMigrations;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
final class Version20260226203000 extends AbstractMigration
|
|
{
|
|
public function getDescription(): string
|
|
{
|
|
return 'Add contract nature to employee contract periods';
|
|
}
|
|
|
|
public function up(Schema $schema): void
|
|
{
|
|
$this->addSql("ALTER TABLE employee_contract_periods ADD contract_nature VARCHAR(20) DEFAULT 'CDI' NOT NULL");
|
|
$this->addSql("
|
|
UPDATE employee_contract_periods p
|
|
SET contract_nature = 'INTERIM'
|
|
FROM contracts c
|
|
WHERE p.contract_id = c.id
|
|
AND LOWER(c.name) LIKE '%interim%'
|
|
");
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$this->addSql('ALTER TABLE employee_contract_periods DROP contract_nature');
|
|
}
|
|
}
|