WIP change animator field

This commit is contained in:
2025-06-19 13:35:17 +02:00
parent 5d810b4230
commit e176319775
7 changed files with 272 additions and 14 deletions

View File

@@ -0,0 +1,63 @@
<?php
declare(strict_types=1);
namespace Chill\Migrations\Event;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20250619102259 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add animator entity to event module';
}
public function up(Schema $schema): void
{
$this->addSql(<<<'SQL'
CREATE SEQUENCE chill_event_animator_id_seq INCREMENT BY 1 MINVALUE 1 START 1
SQL);
$this->addSql(<<<'SQL'
CREATE TABLE chill_event_animator (id INT NOT NULL, thirdparty_id INT DEFAULT NULL, user_id INT DEFAULT NULL, event_id INT NOT NULL, PRIMARY KEY(id))
SQL);
$this->addSql(<<<'SQL'
CREATE INDEX IDX_A7FA35FEC7D3A8E6 ON chill_event_animator (thirdparty_id)
SQL);
$this->addSql(<<<'SQL'
CREATE INDEX IDX_A7FA35FEA76ED395 ON chill_event_animator (user_id)
SQL);
$this->addSql(<<<'SQL'
CREATE INDEX IDX_A7FA35FE71F7E88B ON chill_event_animator (event_id)
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE chill_event_animator ADD CONSTRAINT FK_A7FA35FEC7D3A8E6 FOREIGN KEY (thirdparty_id) REFERENCES chill_3party.third_party (id) NOT DEFERRABLE INITIALLY IMMEDIATE
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE chill_event_animator ADD CONSTRAINT FK_A7FA35FEA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE chill_event_animator ADD CONSTRAINT FK_A7FA35FE71F7E88B FOREIGN KEY (event_id) REFERENCES chill_event_event (id) NOT DEFERRABLE INITIALLY IMMEDIATE
SQL);
}
public function down(Schema $schema): void
{
$this->addSql(<<<'SQL'
DROP SEQUENCE chill_event_animator_id_seq CASCADE
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE chill_event_animator DROP CONSTRAINT FK_A7FA35FEC7D3A8E6
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE chill_event_animator DROP CONSTRAINT FK_A7FA35FEA76ED395
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE chill_event_animator DROP CONSTRAINT FK_A7FA35FE71F7E88B
SQL);
$this->addSql(<<<'SQL'
DROP TABLE chill_event_animator
SQL);
}
}