<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20230524121416 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->skipIf($schema->hasTable('dossier_type_department'), 'Table dossier_type_department already exists');
$dossierTypeTable = $schema->createTable('dossier_type_department');
$dossierTypeTable->addColumn('dossier_type_id', 'string', ['length' => 255, 'notnull' => true]);
$dossierTypeTable->addColumn('department_id', 'string', ['length' => 255, 'notnull' => true]);
$dossierTypeTable->addIndex(['dossier_type_id'], 'IDX_9F28BC1B871665AB');
$dossierTypeTable->addIndex(['department_id'], 'IDX_9F28BC1BAE80F5DF');
$dossierTypeTable->setPrimaryKey(['dossier_type_id', 'department_id']);
$dossierTypeTable->addForeignKeyConstraint('dossier_type', ['dossier_type_id'], ['id'], ['onDelete' => 'CASCADE'], 'FK_9F28BC1B871665AB');
$dossierTypeTable->addForeignKeyConstraint('department', ['department_id'], ['id'], ['onDelete' => 'CASCADE'], 'FK_9F28BC1BAE80F5DF');
}
public function down(Schema $schema): void
{
$this->skipIf(!$schema->hasTable('dossier_type_department'), 'Table dossier_type_department does not exist');
$schema->dropTable('dossier_type_department');
}
}