This commit is contained in:
2022-02-25 09:29:28 +01:00
parent c4e0b68ebe
commit 051ed19f97
11 changed files with 82 additions and 81 deletions

View File

@@ -11,7 +11,6 @@ declare(strict_types=1);
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
@@ -20,6 +19,13 @@ use Doctrine\Migrations\AbstractMigration;
*/
final class Version20180522080432 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE SCHEMA chill_budget CASCADE');
}
public function getDescription(): string
{
return 'Creation of necessary tables for budget bundle';
@@ -44,12 +50,4 @@ final class Version20180522080432 extends AbstractMigration
$this->addSql('ALTER TABLE chill_budget.resource ADD CONSTRAINT FK_5E0A5E97217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_budget.charge ADD CONSTRAINT FK_5C99D2C3217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE SCHEMA chill_budget CASCADE');
}
}

View File

@@ -1,5 +1,12 @@
<?php
/**
* 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.
*/
declare(strict_types=1);
namespace Chill\Migrations\Budget;
@@ -12,6 +19,14 @@ use Doctrine\Migrations\AbstractMigration;
*/
final class Version20220223123742 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->addSql('DROP SEQUENCE chill_budget.charge_id_seq CASCADE');
$this->addSql('DROP SEQUENCE chill_budget.resource_id_seq CASCADE');
$this->addSql('DROP TABLE chill_budget.charge');
$this->addSql('DROP TABLE chill_budget.resource');
}
public function getDescription(): string
{
return 'Creation of necessary tables for budget bundle';
@@ -33,12 +48,4 @@ final class Version20220223123742 extends AbstractMigration
$this->addSql('ALTER TABLE chill_budget.charge ADD CONSTRAINT FK_5C99D2C3217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_budget.resource ADD CONSTRAINT FK_5E0A5E97217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
$this->addSql('DROP SEQUENCE chill_budget.charge_id_seq CASCADE');
$this->addSql('DROP SEQUENCE chill_budget.resource_id_seq CASCADE');
$this->addSql('DROP TABLE chill_budget.charge');
$this->addSql('DROP TABLE chill_budget.resource');
}
}

View File

@@ -1,5 +1,12 @@
<?php
/**
* 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.
*/
declare(strict_types=1);
namespace Chill\Migrations\Budget;
@@ -12,6 +19,14 @@ use Doctrine\Migrations\AbstractMigration;
*/
final class Version20220224090319 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_budget.charge DROP CONSTRAINT FK_5C99D2C3E79FF843');
$this->addSql('ALTER TABLE chill_budget.charge DROP household_id');
$this->addSql('ALTER TABLE chill_budget.resource DROP CONSTRAINT FK_5E0A5E97E79FF843');
$this->addSql('ALTER TABLE chill_budget.resource DROP household_id');
}
public function getDescription(): string
{
return 'Add household to budget AbstractElement';
@@ -26,12 +41,4 @@ final class Version20220224090319 extends AbstractMigration
$this->addSql('ALTER TABLE chill_budget.resource ADD CONSTRAINT FK_5E0A5E97E79FF843 FOREIGN KEY (household_id) REFERENCES chill_person_household (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_5E0A5E97E79FF843 ON chill_budget.resource (household_id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_budget.charge DROP CONSTRAINT FK_5C99D2C3E79FF843');
$this->addSql('ALTER TABLE chill_budget.charge DROP household_id');
$this->addSql('ALTER TABLE chill_budget.resource DROP CONSTRAINT FK_5E0A5E97E79FF843');
$this->addSql('ALTER TABLE chill_budget.resource DROP household_id');
}
}