mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 10:33:49 +00:00
62 lines
2.3 KiB
PHP
62 lines
2.3 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;
|
|
|
|
final class Version20250506114531 extends AbstractMigration
|
|
{
|
|
public function getDescription(): string
|
|
{
|
|
return 'Create event budget element entity';
|
|
}
|
|
|
|
public function up(Schema $schema): void
|
|
{
|
|
$this->addSql(<<<'SQL'
|
|
CREATE SEQUENCE chill_event_budget_element_id_seq INCREMENT BY 1 MINVALUE 1 START 1
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
CREATE TABLE chill_event_budget_element (id INT NOT NULL, event_id INT DEFAULT NULL, kind_id INT DEFAULT NULL, amount NUMERIC(10, 2) NOT NULL, comment_budget_element_comment TEXT DEFAULT NULL, comment_budget_element_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, comment_budget_element_userId INT DEFAULT NULL, PRIMARY KEY(id))
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
CREATE INDEX IDX_BA25859071F7E88B ON chill_event_budget_element (event_id)
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
CREATE INDEX IDX_BA25859030602CA9 ON chill_event_budget_element (kind_id)
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
ALTER TABLE chill_event_budget_element ADD CONSTRAINT FK_BA25859071F7E88B FOREIGN KEY (event_id) REFERENCES chill_event_event (id) NOT DEFERRABLE INITIALLY IMMEDIATE
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
ALTER TABLE chill_event_budget_element ADD CONSTRAINT FK_BA25859030602CA9 FOREIGN KEY (kind_id) REFERENCES chill_event_budget_kind (id) NOT DEFERRABLE INITIALLY IMMEDIATE
|
|
SQL);
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$this->addSql(<<<'SQL'
|
|
DROP SEQUENCE chill_event_budget_element_id_seq CASCADE
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
ALTER TABLE chill_event_budget_element DROP CONSTRAINT FK_BA25859071F7E88B
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
ALTER TABLE chill_event_budget_element DROP CONSTRAINT FK_BA25859030602CA9
|
|
SQL);
|
|
$this->addSql(<<<'SQL'
|
|
DROP TABLE chill_event_budget_element
|
|
SQL);
|
|
}
|
|
}
|