44 lines
2.3 KiB
PHP
44 lines
2.3 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 Version20240812135824 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('CREATE TABLE og_repository (id INT AUTO_INCREMENT NOT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, ip_address VARCHAR(255) NOT NULL, description VARCHAR(255) DEFAULT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_2E0FDA37D17F50A6 (uuid), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
|
|
$this->addSql('ALTER TABLE client ADD repository_id INT DEFAULT NULL');
|
|
$this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C744045550C9D4F7 FOREIGN KEY (repository_id) REFERENCES og_repository (id)');
|
|
$this->addSql('CREATE INDEX IDX_C744045550C9D4F7 ON client (repository_id)');
|
|
$this->addSql('ALTER TABLE network_settings ADD repository_id INT DEFAULT NULL');
|
|
$this->addSql('ALTER TABLE network_settings ADD CONSTRAINT FK_48869B5450C9D4F7 FOREIGN KEY (repository_id) REFERENCES og_repository (id)');
|
|
$this->addSql('CREATE INDEX IDX_48869B5450C9D4F7 ON network_settings (repository_id)');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
// this down() migration is auto-generated, please modify it to your needs
|
|
$this->addSql('ALTER TABLE client DROP FOREIGN KEY FK_C744045550C9D4F7');
|
|
$this->addSql('ALTER TABLE network_settings DROP FOREIGN KEY FK_48869B5450C9D4F7');
|
|
$this->addSql('DROP TABLE og_repository');
|
|
$this->addSql('DROP INDEX IDX_48869B5450C9D4F7 ON network_settings');
|
|
$this->addSql('ALTER TABLE network_settings DROP repository_id');
|
|
$this->addSql('DROP INDEX IDX_C744045550C9D4F7 ON client');
|
|
$this->addSql('ALTER TABLE client DROP repository_id');
|
|
}
|
|
}
|