Easy_solution/migrations/Version20250812113220.php

39 lines
1.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 Version20250812113220 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 apps_organizations (apps_id INT NOT NULL, organizations_id INT NOT NULL, PRIMARY KEY(apps_id, organizations_id))');
$this->addSql('CREATE INDEX IDX_FFE659D5A2D76671 ON apps_organizations (apps_id)');
$this->addSql('CREATE INDEX IDX_FFE659D586288A55 ON apps_organizations (organizations_id)');
$this->addSql('ALTER TABLE apps_organizations ADD CONSTRAINT FK_FFE659D5A2D76671 FOREIGN KEY (apps_id) REFERENCES apps (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE apps_organizations ADD CONSTRAINT FK_FFE659D586288A55 FOREIGN KEY (organizations_id) REFERENCES organizations (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE apps_organizations DROP CONSTRAINT FK_FFE659D5A2D76671');
$this->addSql('ALTER TABLE apps_organizations DROP CONSTRAINT FK_FFE659D586288A55');
$this->addSql('DROP TABLE apps_organizations');
}
}