mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
65 lines
2.2 KiB
PHP
65 lines
2.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/*
|
|
* Chill is a software for social workers
|
|
*
|
|
* For the full copyright and license information, please view
|
|
* the LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Chill\Migrations\Event;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
/**
|
|
* Auto-generated Migration: Please modify to your needs!
|
|
*/
|
|
final class Version20250507073301 extends AbstractMigration
|
|
{
|
|
public function getDescription(): string
|
|
{
|
|
return 'Add animators field to an event';
|
|
}
|
|
|
|
public function up(Schema $schema): void
|
|
{
|
|
$this->addSql(<<<'SQL'
|
|
CREATE TABLE chill_event_thirdparty (event_id INT NOT NULL, thirdparty_id INT NOT NULL, PRIMARY KEY(event_id, thirdparty_id))
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
CREATE INDEX IDX_9946573E71F7E88B ON chill_event_thirdparty (event_id)
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
CREATE INDEX IDX_9946573EC7D3A8E6 ON chill_event_thirdparty (thirdparty_id)
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
ALTER TABLE chill_event_thirdparty ADD CONSTRAINT FK_9946573E71F7E88B FOREIGN KEY (event_id) REFERENCES chill_event_event (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
ALTER TABLE chill_event_thirdparty ADD CONSTRAINT FK_9946573EC7D3A8E6 FOREIGN KEY (thirdparty_id) REFERENCES chill_3party.third_party (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
ALTER TABLE chill_event_event DROP organizationcost
|
|
SQL);
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$this->addSql(<<<'SQL'
|
|
ALTER TABLE chill_event_thirdparty DROP CONSTRAINT FK_9946573E71F7E88B
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
ALTER TABLE chill_event_thirdparty DROP CONSTRAINT FK_9946573EC7D3A8E6
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
DROP TABLE chill_event_thirdparty
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
ALTER TABLE chill_event_event ADD organizationcost NUMERIC(10, 4) DEFAULT '0.0'
|
|
SQL);
|
|
}
|
|
}
|