Easy_solution/migrations/Version20250808091021.php

47 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 Version20250808091021 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 user_organizaton_app DROP CONSTRAINT fk_2c952fc732c8a3de');
$this->addSql('ALTER TABLE user_organizaton_app DROP CONSTRAINT fk_2c952fc767b3b43d');
$this->addSql('DROP INDEX idx_2c952fc732c8a3de');
$this->addSql('DROP INDEX idx_2c952fc767b3b43d');
$this->addSql('ALTER TABLE user_organizaton_app DROP organization_id');
$this->addSql('ALTER TABLE user_organizaton_app RENAME COLUMN users_id TO user_organization_id');
$this->addSql('ALTER TABLE user_organizaton_app ADD CONSTRAINT FK_2C952FC72014CF51 FOREIGN KEY (user_organization_id) REFERENCES users_organizations (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_2C952FC72014CF51 ON user_organizaton_app (user_organization_id)');
}
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 user_organizaton_app DROP CONSTRAINT FK_2C952FC72014CF51');
$this->addSql('DROP INDEX IDX_2C952FC72014CF51');
$this->addSql('ALTER TABLE user_organizaton_app ADD organization_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE user_organizaton_app RENAME COLUMN user_organization_id TO users_id');
$this->addSql('ALTER TABLE user_organizaton_app ADD CONSTRAINT fk_2c952fc732c8a3de FOREIGN KEY (organization_id) REFERENCES organizations (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE user_organizaton_app ADD CONSTRAINT fk_2c952fc767b3b43d FOREIGN KEY (users_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX idx_2c952fc732c8a3de ON user_organizaton_app (organization_id)');
$this->addSql('CREATE INDEX idx_2c952fc767b3b43d ON user_organizaton_app (users_id)');
}
}