feat : ajout du numéro identification des receptions et ajustement du bon de reception
This commit is contained in:
29
migrations/Version20260128000100.php
Normal file
29
migrations/Version20260128000100.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20260128000100 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add identification number to receptions';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE reception ADD identification_number VARCHAR(20) DEFAULT NULL');
|
||||
$this->addSql("UPDATE reception SET identification_number = 'N-BR-' || LPAD(id::text, 4, '0') WHERE identification_number IS NULL");
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_reception_identification_number ON reception (identification_number)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP INDEX UNIQ_reception_identification_number');
|
||||
$this->addSql('ALTER TABLE reception DROP identification_number');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user