44 lines
2.6 KiB
PHP
44 lines
2.6 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 Version20241021071250 extends AbstractMigration
|
|
{
|
|
public function getDescription(): string
|
|
{
|
|
return '';
|
|
}
|
|
|
|
public function up(Schema $schema): void
|
|
{
|
|
// this up() migration is auto-generated, please modify it to your needs
|
|
$this->addSql('ALTER TABLE client DROP FOREIGN KEY FK_C7440455D4CBF752');
|
|
$this->addSql('ALTER TABLE pxe_boot_file DROP FOREIGN KEY FK_7FD1F34B5DA0FB8');
|
|
$this->addSql('DROP TABLE pxe_boot_file');
|
|
$this->addSql('DROP INDEX IDX_C7440455D4CBF752 ON client');
|
|
$this->addSql('ALTER TABLE client CHANGE pxe_boot_file_id template_id INT DEFAULT NULL');
|
|
$this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C74404555DA0FB8 FOREIGN KEY (template_id) REFERENCES pxe_template (id)');
|
|
$this->addSql('CREATE INDEX IDX_C74404555DA0FB8 ON client (template_id)');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
// this down() migration is auto-generated, please modify it to your needs
|
|
$this->addSql('CREATE TABLE pxe_boot_file (id INT AUTO_INCREMENT NOT NULL, template_id INT DEFAULT NULL, uuid CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, updated_by VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, synchronized TINYINT(1) DEFAULT NULL, INDEX IDX_7FD1F34B5DA0FB8 (template_id), UNIQUE INDEX UNIQ_7FD1F34BD17F50A6 (uuid), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
|
|
$this->addSql('ALTER TABLE pxe_boot_file ADD CONSTRAINT FK_7FD1F34B5DA0FB8 FOREIGN KEY (template_id) REFERENCES pxe_template (id)');
|
|
$this->addSql('ALTER TABLE client DROP FOREIGN KEY FK_C74404555DA0FB8');
|
|
$this->addSql('DROP INDEX IDX_C74404555DA0FB8 ON client');
|
|
$this->addSql('ALTER TABLE client CHANGE template_id pxe_boot_file_id INT DEFAULT NULL');
|
|
$this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C7440455D4CBF752 FOREIGN KEY (pxe_boot_file_id) REFERENCES pxe_boot_file (id)');
|
|
$this->addSql('CREATE INDEX IDX_C7440455D4CBF752 ON client (pxe_boot_file_id)');
|
|
}
|
|
}
|