| Numéro du ticket | Titre du ticket | |------------------|-----------------| | | | ## Description de la PR ## Modification du .env ## Check list - [x] Pas de régression - [ ] TU/TI/TF rédigée - [x] TU/TI/TF OK - [x] CHANGELOG modifié Reviewed-on: #7 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
33 lines
1.1 KiB
PHP
33 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DoctrineMigrations;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
final class Version20260127000500 extends AbstractMigration
|
|
{
|
|
public function getDescription(): string
|
|
{
|
|
return 'Add trucks and link receptions to trucks';
|
|
}
|
|
|
|
public function up(Schema $schema): void
|
|
{
|
|
$this->addSql('CREATE TABLE truck (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, name VARCHAR(180) NOT NULL, PRIMARY KEY(id))');
|
|
$this->addSql('ALTER TABLE reception ADD truck_id INT DEFAULT NULL');
|
|
$this->addSql('ALTER TABLE reception ADD CONSTRAINT FK_83DC02E3F7D15B1A FOREIGN KEY (truck_id) REFERENCES truck (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
|
$this->addSql('CREATE INDEX IDX_83DC02E3F7D15B1A ON reception (truck_id)');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$this->addSql('ALTER TABLE reception DROP CONSTRAINT FK_83DC02E3F7D15B1A');
|
|
$this->addSql('DROP INDEX IDX_83DC02E3F7D15B1A');
|
|
$this->addSql('ALTER TABLE reception DROP truck_id');
|
|
$this->addSql('DROP TABLE truck');
|
|
}
|
|
}
|