36 lines
1.4 KiB
PHP
36 lines
1.4 KiB
PHP
|
|
<?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 Version20260206220000 extends AbstractMigration
|
||
|
|
{
|
||
|
|
public function getDescription(): string
|
||
|
|
{
|
||
|
|
return 'Create etat_lieux_file table';
|
||
|
|
}
|
||
|
|
|
||
|
|
public function up(Schema $schema): void
|
||
|
|
{
|
||
|
|
// this up() migration is auto-generated, please modify it to your needs
|
||
|
|
$this->addSql("CREATE TABLE etat_lieux_file (id SERIAL NOT NULL, etat_lieux_id INT NOT NULL, file_name VARCHAR(255) DEFAULT NULL, file_size INT DEFAULT NULL, mime_type VARCHAR(255) DEFAULT NULL, type VARCHAR(50) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))");
|
||
|
|
$this->addSql("COMMENT ON COLUMN etat_lieux_file.created_at IS '(DC2Type:datetime_immutable)'");
|
||
|
|
$this->addSql("CREATE INDEX IDX_5F7E1C87D6F39243 ON etat_lieux_file (etat_lieux_id)");
|
||
|
|
$this->addSql('ALTER TABLE etat_lieux_file ADD CONSTRAINT FK_5F7E1C87D6F39243 FOREIGN KEY (etat_lieux_id) REFERENCES etat_lieux (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function down(Schema $schema): void
|
||
|
|
{
|
||
|
|
// this down() migration is auto-generated, please modify it to your needs
|
||
|
|
$this->addSql('ALTER TABLE etat_lieux_file DROP FOREIGN KEY FK_5F7E1C87D6F39243');
|
||
|
|
$this->addSql('DROP TABLE etat_lieux_file');
|
||
|
|
}
|
||
|
|
}
|