mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,44 +1,49 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
namespace Chill\Migrations\Person;
|
||||
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
class Version20141129010948 extends AbstractMigration
|
||||
{
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql("CREATE SEQUENCE ClosingMotive_id_seq INCREMENT BY 1 MINVALUE 1 START 1;");
|
||||
$this->addSql("CREATE SEQUENCE person_history_file_id_seq INCREMENT BY 1 MINVALUE 1 START 1;");
|
||||
$this->addSql("CREATE SEQUENCE Person_id_seq INCREMENT BY 1 MINVALUE 1 START 1;");
|
||||
$this->addSql("CREATE TABLE ClosingMotive (id INT NOT NULL, name JSON NOT NULL, active BOOLEAN NOT NULL, PRIMARY KEY(id));");
|
||||
$this->addSql("CREATE TABLE person_history_file (id INT NOT NULL, person_id INT DEFAULT NULL, date_opening DATE NOT NULL, date_closing DATE DEFAULT NULL, memo TEXT NOT NULL, closingMotive_id INT DEFAULT NULL, PRIMARY KEY(id));");
|
||||
$this->addSql("CREATE INDEX IDX_64A4A621217BBB47 ON person_history_file (person_id);");
|
||||
$this->addSql("CREATE INDEX IDX_64A4A621504CB38D ON person_history_file (closingMotive_id);");
|
||||
$this->addSql("CREATE TABLE Person (id INT NOT NULL, nationality_id INT DEFAULT NULL, firstName VARCHAR(255) NOT NULL, lastName VARCHAR(255) NOT NULL, date_of_birth DATE DEFAULT NULL, place_of_birth VARCHAR(255) NOT NULL, genre VARCHAR(9) NOT NULL, memo TEXT NOT NULL, email TEXT NOT NULL, proxyHistoryOpenState BOOLEAN NOT NULL, cFData TEXT NOT NULL, phonenumber TEXT DEFAULT NULL, countryOfBirth_id INT DEFAULT NULL, PRIMARY KEY(id));");
|
||||
$this->addSql("CREATE INDEX IDX_3370D4403818DA5 ON Person (countryOfBirth_id);");
|
||||
$this->addSql("CREATE INDEX IDX_3370D4401C9DA55 ON Person (nationality_id);");
|
||||
$this->addSql("CREATE INDEX person_names ON Person (firstName, lastName);");
|
||||
$this->addSql("COMMENT ON COLUMN Person.cFData IS '(DC2Type:array)';");
|
||||
$this->addSql("CREATE TABLE persons_spoken_languages (person_id INT NOT NULL, language_id VARCHAR(255) NOT NULL, PRIMARY KEY(person_id, language_id));");
|
||||
$this->addSql("CREATE INDEX IDX_7201106F217BBB47 ON persons_spoken_languages (person_id);");
|
||||
$this->addSql("CREATE INDEX IDX_7201106F82F1BAF4 ON persons_spoken_languages (language_id);");
|
||||
$this->addSql("ALTER TABLE person_history_file ADD CONSTRAINT FK_64A4A621217BBB47 FOREIGN KEY (person_id) REFERENCES Person (id) NOT DEFERRABLE INITIALLY IMMEDIATE;");
|
||||
$this->addSql("ALTER TABLE person_history_file ADD CONSTRAINT FK_64A4A621504CB38D FOREIGN KEY (closingMotive_id) REFERENCES ClosingMotive (id) NOT DEFERRABLE INITIALLY IMMEDIATE;");
|
||||
$this->addSql("ALTER TABLE Person ADD CONSTRAINT FK_3370D4403818DA5 FOREIGN KEY (countryOfBirth_id) REFERENCES Country (id) NOT DEFERRABLE INITIALLY IMMEDIATE;");
|
||||
$this->addSql("ALTER TABLE Person ADD CONSTRAINT FK_3370D4401C9DA55 FOREIGN KEY (nationality_id) REFERENCES Country (id) NOT DEFERRABLE INITIALLY IMMEDIATE;");
|
||||
$this->addSql("ALTER TABLE persons_spoken_languages ADD CONSTRAINT FK_7201106F217BBB47 FOREIGN KEY (person_id) REFERENCES Person (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE;");
|
||||
$this->addSql("ALTER TABLE persons_spoken_languages ADD CONSTRAINT FK_7201106F82F1BAF4 FOREIGN KEY (language_id) REFERENCES Language (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE;");
|
||||
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE SEQUENCE ClosingMotive_id_seq INCREMENT BY 1 MINVALUE 1 START 1;');
|
||||
$this->addSql('CREATE SEQUENCE person_history_file_id_seq INCREMENT BY 1 MINVALUE 1 START 1;');
|
||||
$this->addSql('CREATE SEQUENCE Person_id_seq INCREMENT BY 1 MINVALUE 1 START 1;');
|
||||
$this->addSql('CREATE TABLE ClosingMotive (id INT NOT NULL, name JSON NOT NULL, active BOOLEAN NOT NULL, PRIMARY KEY(id));');
|
||||
$this->addSql('CREATE TABLE person_history_file (id INT NOT NULL, person_id INT DEFAULT NULL, date_opening DATE NOT NULL, date_closing DATE DEFAULT NULL, memo TEXT NOT NULL, closingMotive_id INT DEFAULT NULL, PRIMARY KEY(id));');
|
||||
$this->addSql('CREATE INDEX IDX_64A4A621217BBB47 ON person_history_file (person_id);');
|
||||
$this->addSql('CREATE INDEX IDX_64A4A621504CB38D ON person_history_file (closingMotive_id);');
|
||||
$this->addSql('CREATE TABLE Person (id INT NOT NULL, nationality_id INT DEFAULT NULL, firstName VARCHAR(255) NOT NULL, lastName VARCHAR(255) NOT NULL, date_of_birth DATE DEFAULT NULL, place_of_birth VARCHAR(255) NOT NULL, genre VARCHAR(9) NOT NULL, memo TEXT NOT NULL, email TEXT NOT NULL, proxyHistoryOpenState BOOLEAN NOT NULL, cFData TEXT NOT NULL, phonenumber TEXT DEFAULT NULL, countryOfBirth_id INT DEFAULT NULL, PRIMARY KEY(id));');
|
||||
$this->addSql('CREATE INDEX IDX_3370D4403818DA5 ON Person (countryOfBirth_id);');
|
||||
$this->addSql('CREATE INDEX IDX_3370D4401C9DA55 ON Person (nationality_id);');
|
||||
$this->addSql('CREATE INDEX person_names ON Person (firstName, lastName);');
|
||||
$this->addSql("COMMENT ON COLUMN Person.cFData IS '(DC2Type:array)';");
|
||||
$this->addSql('CREATE TABLE persons_spoken_languages (person_id INT NOT NULL, language_id VARCHAR(255) NOT NULL, PRIMARY KEY(person_id, language_id));');
|
||||
$this->addSql('CREATE INDEX IDX_7201106F217BBB47 ON persons_spoken_languages (person_id);');
|
||||
$this->addSql('CREATE INDEX IDX_7201106F82F1BAF4 ON persons_spoken_languages (language_id);');
|
||||
$this->addSql('ALTER TABLE person_history_file ADD CONSTRAINT FK_64A4A621217BBB47 FOREIGN KEY (person_id) REFERENCES Person (id) NOT DEFERRABLE INITIALLY IMMEDIATE;');
|
||||
$this->addSql('ALTER TABLE person_history_file ADD CONSTRAINT FK_64A4A621504CB38D FOREIGN KEY (closingMotive_id) REFERENCES ClosingMotive (id) NOT DEFERRABLE INITIALLY IMMEDIATE;');
|
||||
$this->addSql('ALTER TABLE Person ADD CONSTRAINT FK_3370D4403818DA5 FOREIGN KEY (countryOfBirth_id) REFERENCES Country (id) NOT DEFERRABLE INITIALLY IMMEDIATE;');
|
||||
$this->addSql('ALTER TABLE Person ADD CONSTRAINT FK_3370D4401C9DA55 FOREIGN KEY (nationality_id) REFERENCES Country (id) NOT DEFERRABLE INITIALLY IMMEDIATE;');
|
||||
$this->addSql('ALTER TABLE persons_spoken_languages ADD CONSTRAINT FK_7201106F217BBB47 FOREIGN KEY (person_id) REFERENCES Person (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE;');
|
||||
$this->addSql('ALTER TABLE persons_spoken_languages ADD CONSTRAINT FK_7201106F82F1BAF4 FOREIGN KEY (language_id) REFERENCES Language (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE;');
|
||||
}
|
||||
}
|
||||
|
@@ -1,30 +1,36 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
namespace Chill\Migrations\Person;
|
||||
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
class Version20150212173934 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE accompanying_period RENAME TO person_history_file;');
|
||||
$this->addSql('ALTER TABLE person RENAME proxyAccompanyingPeriodOpenState TO proxyHistoryOpenState;');
|
||||
$this->addSql('ALTER SEQUENCE accompanying_period_id_seq RENAME TO person_history_file_id_seq;');
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
|
||||
$this->addSql("ALTER TABLE person RENAME proxyHistoryOpenState TO proxyAccompanyingPeriodOpenState;");
|
||||
$this->addSql("ALTER TABLE person_history_file RENAME TO accompanying_period;");
|
||||
$this->addSql("ALTER SEQUENCE person_history_file_id_seq RENAME TO accompanying_period_id_seq;");
|
||||
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql("ALTER TABLE accompanying_period RENAME TO person_history_file;");
|
||||
$this->addSql("ALTER TABLE person RENAME proxyAccompanyingPeriodOpenState TO proxyHistoryOpenState;");
|
||||
$this->addSql("ALTER SEQUENCE accompanying_period_id_seq RENAME TO person_history_file_id_seq;");
|
||||
$this->addSql('ALTER TABLE person RENAME proxyHistoryOpenState TO proxyAccompanyingPeriodOpenState;');
|
||||
$this->addSql('ALTER TABLE person_history_file RENAME TO accompanying_period;');
|
||||
$this->addSql('ALTER SEQUENCE person_history_file_id_seq RENAME TO accompanying_period_id_seq;');
|
||||
}
|
||||
}
|
||||
|
@@ -1,58 +1,23 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
namespace Chill\Migrations\Person;
|
||||
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add a center to class person
|
||||
* Add a center to class person.
|
||||
*/
|
||||
class Version20150607231010 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add a center on the person entity. The default center is the first '
|
||||
. 'recorded.';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->abortIf(
|
||||
$this->connection->getDatabasePlatform()->getName() != 'postgresql',
|
||||
'Migration can only be executed safely on \'postgresql\'.'
|
||||
);
|
||||
|
||||
$this->addSql('ALTER TABLE person ADD center_id INT');
|
||||
|
||||
// retrieve center for setting a default center
|
||||
$stmt = $this->connection->executeQuery("SELECT id FROM centers ORDER BY id ASC LIMIT 1");
|
||||
$center = $stmt->fetchOne();
|
||||
|
||||
if ($center !== false) {
|
||||
$defaultCenterId = $center['id'];
|
||||
}
|
||||
|
||||
if (isset($defaultCenterId)) {
|
||||
$this->addSql('UPDATE person SET center_id = :id', array('id' => $defaultCenterId));
|
||||
}
|
||||
|
||||
// this will fail if a person is defined, which should not happen any more at this
|
||||
// time of writing (2021-11-09)
|
||||
$this->addSql('ALTER TABLE person ALTER center_id SET NOT NULL');
|
||||
$this->addSql('ALTER TABLE person '
|
||||
. 'ADD CONSTRAINT FK_person_center FOREIGN KEY (center_id) '
|
||||
. 'REFERENCES centers (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX IDX_person_center ON person (center_id)');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->abortIf(
|
||||
@@ -64,4 +29,40 @@ class Version20150607231010 extends AbstractMigration
|
||||
$this->addSql('DROP INDEX IDX_person_center');
|
||||
$this->addSql('ALTER TABLE Person DROP center_id');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add a center on the person entity. The default center is the first '
|
||||
. 'recorded.';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->abortIf(
|
||||
$this->connection->getDatabasePlatform()->getName() != 'postgresql',
|
||||
'Migration can only be executed safely on \'postgresql\'.'
|
||||
);
|
||||
|
||||
$this->addSql('ALTER TABLE person ADD center_id INT');
|
||||
|
||||
// retrieve center for setting a default center
|
||||
$stmt = $this->connection->executeQuery('SELECT id FROM centers ORDER BY id ASC LIMIT 1');
|
||||
$center = $stmt->fetchOne();
|
||||
|
||||
if (false !== $center) {
|
||||
$defaultCenterId = $center['id'];
|
||||
}
|
||||
|
||||
if (isset($defaultCenterId)) {
|
||||
$this->addSql('UPDATE person SET center_id = :id', ['id' => $defaultCenterId]);
|
||||
}
|
||||
|
||||
// this will fail if a person is defined, which should not happen any more at this
|
||||
// time of writing (2021-11-09)
|
||||
$this->addSql('ALTER TABLE person ALTER center_id SET NOT NULL');
|
||||
$this->addSql('ALTER TABLE person '
|
||||
. 'ADD CONSTRAINT FK_person_center FOREIGN KEY (center_id) '
|
||||
. 'REFERENCES centers (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX IDX_person_center ON person (center_id)');
|
||||
}
|
||||
}
|
||||
|
@@ -1,66 +1,44 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
|
||||
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\Migrations\Person;
|
||||
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Migration for adapting the Person Bundle to the 'cahier de charge' :
|
||||
* - RENAMING :
|
||||
* - - date_of_birth TO birthdate
|
||||
* - - genre to gender
|
||||
*
|
||||
* - - genre to gender.
|
||||
*/
|
||||
class Version20150811152608 extends AbstractMigration
|
||||
{
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->abortIf(
|
||||
$this->connection->getDatabasePlatform()->getName() != 'postgresql',
|
||||
'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('ALTER TABLE person RENAME COLUMN date_of_birth TO birthdate');
|
||||
$this->addSql('ALTER TABLE person RENAME COLUMN genre TO gender');
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->abortIf(
|
||||
$this->connection->getDatabasePlatform()->getName() != 'postgresql',
|
||||
'Migration can only be executed safely on \'postgresql\'.');
|
||||
'Migration can only be executed safely on \'postgresql\'.'
|
||||
);
|
||||
|
||||
$this->addSql('ALTER TABLE person RENAME COLUMN birthdate TO date_of_birth');
|
||||
$this->addSql('ALTER TABLE person RENAME COLUMN gender TO genre');
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->abortIf(
|
||||
$this->connection->getDatabasePlatform()->getName() != 'postgresql',
|
||||
'Migration can only be executed safely on \'postgresql\'.'
|
||||
);
|
||||
|
||||
$this->addSql('ALTER TABLE person RENAME COLUMN date_of_birth TO birthdate');
|
||||
$this->addSql('ALTER TABLE person RENAME COLUMN genre TO gender');
|
||||
}
|
||||
}
|
||||
|
@@ -1,43 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
|
||||
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\Migrations\Person;
|
||||
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Migration for adding maritalstatus to person
|
||||
* Migration for adding maritalstatus to person.
|
||||
*/
|
||||
class Version20150812110708 extends AbstractMigration
|
||||
{
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->abortIf(
|
||||
$this->connection->getDatabasePlatform()->getName() != 'postgresql',
|
||||
'Migration can only be executed safely on \'postgresql\'.'
|
||||
);
|
||||
|
||||
$this->addSql('ALTER TABLE person DROP CONSTRAINT fk_person_marital_status;');
|
||||
$this->addSql('ALTER TABLE person DROP COLUMN maritalstatus_id;');
|
||||
$this->addSql('DROP TABLE marital_status;');
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->abortIf(
|
||||
$this->connection->getDatabasePlatform()->getName() != 'postgresql',
|
||||
'Migration can only be executed safely on \'postgresql\'.');
|
||||
'Migration can only be executed safely on \'postgresql\'.'
|
||||
);
|
||||
|
||||
$this->addSql('CREATE TABLE marital_status (
|
||||
id character varying(10) NOT NULL,
|
||||
@@ -46,18 +43,4 @@ class Version20150812110708 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE person ADD COLUMN maritalstatus_id character varying(10)');
|
||||
$this->addSql('ALTER TABLE person ADD CONSTRAINT fk_person_marital_status FOREIGN KEY (maritalstatus_id) REFERENCES marital_status (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->abortIf(
|
||||
$this->connection->getDatabasePlatform()->getName() != 'postgresql',
|
||||
'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('ALTER TABLE person DROP CONSTRAINT fk_person_marital_status;');
|
||||
$this->addSql('ALTER TABLE person DROP COLUMN maritalstatus_id;');
|
||||
$this->addSql('DROP TABLE marital_status;');
|
||||
}
|
||||
}
|
||||
|
@@ -1,61 +1,44 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
|
||||
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\Migrations\Person;
|
||||
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Migration for adapting the Person Bundle to the 'cahier de charge' :
|
||||
* - update of accompanyingPerid
|
||||
* - update of accompanyingPerid.
|
||||
*/
|
||||
class Version20150820113409 extends AbstractMigration
|
||||
{
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->abortIf(
|
||||
$this->connection->getDatabasePlatform()->getName() != 'postgresql',
|
||||
'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('ALTER TABLE accompanying_period RENAME COLUMN date_opening TO openingdate;');
|
||||
$this->addSql('ALTER TABLE accompanying_period RENAME COLUMN date_closing TO closingdate;');
|
||||
$this->addSql('ALTER TABLE accompanying_period RENAME COLUMN memo TO remark;');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->abortIf(
|
||||
$this->connection->getDatabasePlatform()->getName() != 'postgresql',
|
||||
'Migration can only be executed safely on \'postgresql\'.');
|
||||
'Migration can only be executed safely on \'postgresql\'.'
|
||||
);
|
||||
|
||||
$this->addSql('ALTER TABLE accompanying_period RENAME COLUMN openingdate TO date_opening;');
|
||||
$this->addSql('ALTER TABLE accompanying_period RENAME COLUMN closingdate TO date_closing;');
|
||||
$this->addSql('ALTER TABLE accompanying_period RENAME COLUMN remark TO memo;');
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->abortIf(
|
||||
$this->connection->getDatabasePlatform()->getName() != 'postgresql',
|
||||
'Migration can only be executed safely on \'postgresql\'.'
|
||||
);
|
||||
|
||||
$this->addSql('ALTER TABLE accompanying_period RENAME COLUMN date_opening TO openingdate;');
|
||||
$this->addSql('ALTER TABLE accompanying_period RENAME COLUMN date_closing TO closingdate;');
|
||||
$this->addSql('ALTER TABLE accompanying_period RENAME COLUMN memo TO remark;');
|
||||
}
|
||||
}
|
||||
|
@@ -1,18 +1,29 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
namespace Chill\Migrations\Person;
|
||||
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add a many-to-many relationship between person and addresses
|
||||
* Add a many-to-many relationship between person and addresses.
|
||||
*/
|
||||
class Version20160310161006 extends AbstractMigration
|
||||
{
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('DROP TABLE chill_person_persons_to_addresses');
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
@@ -35,15 +46,4 @@ class Version20160310161006 extends AbstractMigration
|
||||
. 'FOREIGN KEY (address_id) '
|
||||
. 'REFERENCES chill_main_address (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('DROP TABLE chill_person_persons_to_addresses');
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,18 +1,26 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
namespace Chill\Migrations\Person;
|
||||
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Check if each person do not have multiple addresses with the same valideFrom
|
||||
* Check if each person do not have multiple addresses with the same valideFrom.
|
||||
*/
|
||||
class Version20160422000000 extends AbstractMigration
|
||||
{
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$stmt = $this->connection->query('SELECT COUNT(*), pe.id, ad.validfrom FROM person AS pe
|
||||
@@ -20,23 +28,16 @@ class Version20160422000000 extends AbstractMigration
|
||||
INNER JOIN chill_main_address AS ad ON ad.id = pe_ad.address_id
|
||||
GROUP BY pe.id, ad.validfrom
|
||||
HAVING COUNT(*) > 1');
|
||||
|
||||
|
||||
$personWithTwoAddressWithSameValidFrom = $stmt->fetchAll();
|
||||
|
||||
|
||||
foreach ($personWithTwoAddressWithSameValidFrom as $p) {
|
||||
$this->warnIf(true, 'The person with id '.$p['id'].' has two adresses with the same validFrom date');
|
||||
$this->warnIf(true, 'The person with id ' . $p['id'] . ' has two adresses with the same validFrom date');
|
||||
}
|
||||
|
||||
|
||||
$this->abortIf(
|
||||
sizeof($personWithTwoAddressWithSameValidFrom) != 0,
|
||||
'There exists some person with multiple adress with the same validFrom'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@@ -1,21 +1,36 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
namespace Chill\Migrations\Person;
|
||||
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* This migration store the cfdata using the postgresql jsonb type instead
|
||||
* of the result of the sterialization
|
||||
* of the result of the sterialization.
|
||||
*/
|
||||
class Version20160818113633 extends AbstractMigration
|
||||
{
|
||||
/**
|
||||
* Inverse of up.
|
||||
*/
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSQL('ALTER TABLE person DROP COLUMN cfdata');
|
||||
$this->addSQL('ALTER TABLE person RENAME COLUMN cfdata_old TO cfdata');
|
||||
$this->addSql('ALTER TABLE person ALTER COLUMN cfdata SET NOT NULL');
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a copy of the column cfdata into the column cfdata_old. Then
|
||||
* remplace the sterialized data into a json data.
|
||||
*
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
@@ -35,16 +50,4 @@ class Version20160818113633 extends AbstractMigration
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inverse of up
|
||||
*
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSQL('ALTER TABLE person DROP COLUMN cfdata');
|
||||
$this->addSQL('ALTER TABLE person RENAME COLUMN cfdata_old TO cfdata');
|
||||
$this->addSql('ALTER TABLE person ALTER COLUMN cfdata SET NOT NULL');
|
||||
}
|
||||
}
|
||||
|
@@ -1,35 +1,22 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
namespace Chill\Migrations\Person;
|
||||
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add the prefix 'chill_person' to all the (db) table name of this bundle
|
||||
* Add the prefix 'chill_person' to all the (db) table name of this bundle.
|
||||
*/
|
||||
class Version20160818151130 extends AbstractMigration
|
||||
{
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE person RENAME TO chill_person_person');
|
||||
$this->addSql('ALTER TABLE person_id_seq RENAME TO chill_person_person_id_seq');
|
||||
|
||||
$this->addSql('ALTER TABLE marital_status RENAME TO chill_person_marital_status');
|
||||
|
||||
$this->addSql('ALTER TABLE accompanying_period RENAME TO chill_person_accompanying_period');
|
||||
$this->addSql('ALTER TABLE accompanying_period_id_seq RENAME TO chill_person_accompanying_period_id_seq');
|
||||
|
||||
$this->addSql('ALTER TABLE closingmotive RENAME TO chill_person_closingmotive');
|
||||
$this->addSql('ALTER TABLE closingmotive_id_seq RENAME TO chill_person_closingmotive_id_seq');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSQL('ALTER TABLE chill_person_person RENAME TO person');
|
||||
@@ -43,4 +30,18 @@ class Version20160818151130 extends AbstractMigration
|
||||
$this->addSQL('ALTER TABLE chill_person_closingmotive RENAME TO closingmotive');
|
||||
$this->addSql('ALTER TABLE chill_person_closingmotive_id_seq RENAME TO closingmotive_id_seq');
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE person RENAME TO chill_person_person');
|
||||
$this->addSql('ALTER TABLE person_id_seq RENAME TO chill_person_person_id_seq');
|
||||
|
||||
$this->addSql('ALTER TABLE marital_status RENAME TO chill_person_marital_status');
|
||||
|
||||
$this->addSql('ALTER TABLE accompanying_period RENAME TO chill_person_accompanying_period');
|
||||
$this->addSql('ALTER TABLE accompanying_period_id_seq RENAME TO chill_person_accompanying_period_id_seq');
|
||||
|
||||
$this->addSql('ALTER TABLE closingmotive RENAME TO chill_person_closingmotive');
|
||||
$this->addSql('ALTER TABLE closingmotive_id_seq RENAME TO chill_person_closingmotive_id_seq');
|
||||
}
|
||||
}
|
||||
|
@@ -1,123 +1,125 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
namespace Chill\Migrations\Person;
|
||||
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add postgresql functions to compute last address on person.
|
||||
*/
|
||||
class Version20170117131924 extends AbstractMigration
|
||||
{
|
||||
|
||||
public $fields = array(
|
||||
'address_id' => 'integer',
|
||||
'streetaddress1' => 'varchar(255)',
|
||||
'streetaddress2' => 'varchar(255)',
|
||||
'validfrom' => 'date',
|
||||
'postcode_label' => 'varchar(255)',
|
||||
'postcode_code' => 'varchar(100)',
|
||||
'postcode_id' => 'integer',
|
||||
'country_name' => 'json',
|
||||
'country_code' => 'varchar(3)',
|
||||
'country_id' => 'integer'
|
||||
);
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql(<<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION public.get_last_address (
|
||||
pid integer,
|
||||
before_date date)
|
||||
RETURNS TABLE(
|
||||
person_id integer,
|
||||
address_id integer,
|
||||
streetaddress1 varchar(255),
|
||||
streetaddress2 varchar(255),
|
||||
validfrom date,
|
||||
postcode_label varchar(255),
|
||||
postcode_code varchar(100),
|
||||
postcode_id integer,
|
||||
country_name json,
|
||||
country_code varchar(3),
|
||||
country_id integer)
|
||||
AS
|
||||
$BODY$
|
||||
SELECT
|
||||
pid AS person_id,
|
||||
chill_main_address.id AS address_id,
|
||||
chill_main_address.streetaddress1,
|
||||
chill_main_address.streetaddress2,
|
||||
chill_main_address.validfrom,
|
||||
chill_main_postal_code.label,
|
||||
chill_main_postal_code.code,
|
||||
chill_main_postal_code.id AS postal_code_id,
|
||||
country.name,
|
||||
country.countrycode,
|
||||
country.id AS country_id
|
||||
FROM chill_main_address
|
||||
JOIN (
|
||||
SELECT
|
||||
chill_main_address.id AS address_id,
|
||||
validfrom,
|
||||
rank() OVER (PARTITION BY person_id ORDER BY validfrom DESC) as pos
|
||||
FROM chill_person_persons_to_addresses
|
||||
JOIN chill_main_address ON chill_person_persons_to_addresses.address_id = chill_main_address.id
|
||||
WHERE person_id = pid
|
||||
AND chill_main_address.validfrom <= before_date
|
||||
) AS ranking ON ranking.address_id = chill_main_address.id
|
||||
JOIN chill_main_postal_code ON chill_main_address.postcode_id = chill_main_postal_code.id
|
||||
JOIN country ON chill_main_postal_code.country_id = country.id
|
||||
WHERE ranking.pos = 1
|
||||
$BODY$
|
||||
LANGUAGE sql VOLATILE
|
||||
COST 100;
|
||||
SQL
|
||||
);
|
||||
|
||||
// create function to get part of address
|
||||
foreach ($this->fields as $var => $type) {
|
||||
$this->addSql(sprintf(<<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION get_last_address_%s (
|
||||
pid integer,
|
||||
before_date date)
|
||||
RETURNS %s AS
|
||||
$BODY$
|
||||
SELECT %s FROM get_last_address(pid, before_date)
|
||||
$BODY$
|
||||
LANGUAGE sql volatile
|
||||
COST 100;
|
||||
SQL
|
||||
, $var, $type, $var));
|
||||
}
|
||||
}
|
||||
public $fields = [
|
||||
'address_id' => 'integer',
|
||||
'streetaddress1' => 'varchar(255)',
|
||||
'streetaddress2' => 'varchar(255)',
|
||||
'validfrom' => 'date',
|
||||
'postcode_label' => 'varchar(255)',
|
||||
'postcode_code' => 'varchar(100)',
|
||||
'postcode_id' => 'integer',
|
||||
'country_name' => 'json',
|
||||
'country_code' => 'varchar(3)',
|
||||
'country_id' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// drop function to get parts of address
|
||||
foreach ($this->fields as $var => $type) {
|
||||
$this->addSql(<<<SQL
|
||||
$this->addSql(
|
||||
<<<SQL
|
||||
|
||||
DROP FUNCTION get_last_address_$var (
|
||||
pid integer,
|
||||
before_date date)
|
||||
SQL
|
||||
);
|
||||
}
|
||||
|
||||
$this->addSQL(<<<SQL
|
||||
DROP FUNCTION public.get_last_address (
|
||||
pid integer,
|
||||
before_date date)
|
||||
SQL
|
||||
DROP FUNCTION get_last_address_{$var} (
|
||||
pid integer,
|
||||
before_date date)
|
||||
SQL
|
||||
);
|
||||
}
|
||||
|
||||
$this->addSQL(
|
||||
<<<'SQL'
|
||||
DROP FUNCTION public.get_last_address (
|
||||
pid integer,
|
||||
before_date date)
|
||||
SQL
|
||||
);
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql(
|
||||
<<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION public.get_last_address (
|
||||
pid integer,
|
||||
before_date date)
|
||||
RETURNS TABLE(
|
||||
person_id integer,
|
||||
address_id integer,
|
||||
streetaddress1 varchar(255),
|
||||
streetaddress2 varchar(255),
|
||||
validfrom date,
|
||||
postcode_label varchar(255),
|
||||
postcode_code varchar(100),
|
||||
postcode_id integer,
|
||||
country_name json,
|
||||
country_code varchar(3),
|
||||
country_id integer)
|
||||
AS
|
||||
$BODY$
|
||||
SELECT
|
||||
pid AS person_id,
|
||||
chill_main_address.id AS address_id,
|
||||
chill_main_address.streetaddress1,
|
||||
chill_main_address.streetaddress2,
|
||||
chill_main_address.validfrom,
|
||||
chill_main_postal_code.label,
|
||||
chill_main_postal_code.code,
|
||||
chill_main_postal_code.id AS postal_code_id,
|
||||
country.name,
|
||||
country.countrycode,
|
||||
country.id AS country_id
|
||||
FROM chill_main_address
|
||||
JOIN (
|
||||
SELECT
|
||||
chill_main_address.id AS address_id,
|
||||
validfrom,
|
||||
rank() OVER (PARTITION BY person_id ORDER BY validfrom DESC) as pos
|
||||
FROM chill_person_persons_to_addresses
|
||||
JOIN chill_main_address ON chill_person_persons_to_addresses.address_id = chill_main_address.id
|
||||
WHERE person_id = pid
|
||||
AND chill_main_address.validfrom <= before_date
|
||||
) AS ranking ON ranking.address_id = chill_main_address.id
|
||||
JOIN chill_main_postal_code ON chill_main_address.postcode_id = chill_main_postal_code.id
|
||||
JOIN country ON chill_main_postal_code.country_id = country.id
|
||||
WHERE ranking.pos = 1
|
||||
$BODY$
|
||||
LANGUAGE sql VOLATILE
|
||||
COST 100;
|
||||
SQL
|
||||
);
|
||||
|
||||
// create function to get part of address
|
||||
foreach ($this->fields as $var => $type) {
|
||||
$this->addSql(sprintf(<<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION get_last_address_%s (
|
||||
pid integer,
|
||||
before_date date)
|
||||
RETURNS %s AS
|
||||
$BODY$
|
||||
SELECT %s FROM get_last_address(pid, before_date)
|
||||
$BODY$
|
||||
LANGUAGE sql volatile
|
||||
COST 100;
|
||||
SQL
|
||||
, $var, $type, $var));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,24 +1,24 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?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\Person;
|
||||
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add a contactInfo and a mobilenumber columns on person. Change the email column.
|
||||
*/
|
||||
final class Version20180518144221 extends AbstractMigration
|
||||
{
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD contactInfo TEXT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD mobilenumber TEXT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER email DROP NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
@@ -27,4 +27,13 @@ final class Version20180518144221 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP mobilenumber');
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER email SET NOT NULL');
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD contactInfo TEXT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD mobilenumber TEXT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER email DROP NOT NULL');
|
||||
}
|
||||
}
|
||||
|
@@ -1,26 +1,26 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?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\Person;
|
||||
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Correction: copie les infos de email vers contactInfo.
|
||||
*
|
||||
*
|
||||
* Previously, data from contact where stored in 'email' column
|
||||
*/
|
||||
final class Version20180820120000 extends AbstractMigration
|
||||
{
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('UPDATE chill_person_person SET contactInfo=email');
|
||||
$this->addSql('UPDATE chill_person_person SET email=\'\'');
|
||||
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
@@ -28,4 +28,12 @@ final class Version20180820120000 extends AbstractMigration
|
||||
$this->addSql('UPDATE chill_person_person SET email=contactInfo');
|
||||
$this->addSql('UPDATE chill_person_person SET contactInfo=\'\'');
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('UPDATE chill_person_person SET contactInfo=email');
|
||||
$this->addSql('UPDATE chill_person_person SET email=\'\'');
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,13 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?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\Person;
|
||||
|
||||
@@ -6,21 +15,21 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Set person gender not null
|
||||
* Set person gender not null.
|
||||
*/
|
||||
final class Version20181005140249 extends AbstractMigration
|
||||
{
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER gender DROP NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER gender SET NOT NULL');
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER gender DROP NOT NULL');
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,13 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?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\Person;
|
||||
|
||||
@@ -6,65 +15,10 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add fullnameCanonical column for trigram matching (fast searching)
|
||||
* Add fullnameCanonical column for trigram matching (fast searching).
|
||||
*/
|
||||
final class Version20181023101621 extends AbstractMigration
|
||||
{
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql("ALTER TABLE chill_person_person ADD fullnameCanonical VARCHAR(255) DEFAULT '' ");
|
||||
$this->addSql("UPDATE chill_person_person SET fullnameCanonical=LOWER(UNACCENT(CONCAT(firstname, ' ', lastname)))");
|
||||
$this->addSql("CREATE INDEX fullnameCanonical_trgm_idx ON chill_person_person USING GIN (fullnameCanonical gin_trgm_ops)");
|
||||
|
||||
$this->addSql(<<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION canonicalize_fullname_on_update() RETURNS TRIGGER AS
|
||||
$BODY$
|
||||
BEGIN
|
||||
IF NEW.firstname <> OLD.firstname OR NEW.lastname <> OLD.lastname
|
||||
THEN
|
||||
UPDATE chill_person_person
|
||||
SET fullnameCanonical=LOWER(UNACCENT(CONCAT(NEW.firstname, ' ', NEW.lastname)))
|
||||
WHERE id=NEW.id;
|
||||
END IF;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$BODY$ LANGUAGE PLPGSQL;
|
||||
SQL
|
||||
);
|
||||
$this->addSql(<<<SQL
|
||||
CREATE TRIGGER canonicalize_fullname_on_update
|
||||
AFTER UPDATE
|
||||
ON chill_person_person
|
||||
FOR EACH ROW
|
||||
WHEN (pg_trigger_depth() = 0)
|
||||
EXECUTE PROCEDURE canonicalize_fullname_on_update();
|
||||
SQL
|
||||
);
|
||||
|
||||
$this->addSql(<<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION canonicalize_fullname_on_insert() RETURNS TRIGGER AS
|
||||
$BODY$
|
||||
BEGIN
|
||||
UPDATE chill_person_person
|
||||
SET fullnameCanonical=LOWER(UNACCENT(CONCAT(NEW.firstname, ' ', NEW.lastname)))
|
||||
WHERE id=NEW.id;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$BODY$ LANGUAGE PLPGSQL;
|
||||
SQL
|
||||
);
|
||||
$this->addSql(<<<SQL
|
||||
CREATE TRIGGER canonicalize_fullname_on_insert
|
||||
AFTER INSERT
|
||||
ON chill_person_person
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE canonicalize_fullname_on_insert();
|
||||
SQL
|
||||
);
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
@@ -76,4 +30,63 @@ SQL
|
||||
$this->addSql('DROP TRIGGER canonicalize_fullname_on_insert ON chill_person_person');
|
||||
$this->addSql('DROP FUNCTION canonicalize_fullname_on_insert()');
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql("ALTER TABLE chill_person_person ADD fullnameCanonical VARCHAR(255) DEFAULT '' ");
|
||||
$this->addSql("UPDATE chill_person_person SET fullnameCanonical=LOWER(UNACCENT(CONCAT(firstname, ' ', lastname)))");
|
||||
$this->addSql('CREATE INDEX fullnameCanonical_trgm_idx ON chill_person_person USING GIN (fullnameCanonical gin_trgm_ops)');
|
||||
|
||||
$this->addSql(
|
||||
<<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION canonicalize_fullname_on_update() RETURNS TRIGGER AS
|
||||
$BODY$
|
||||
BEGIN
|
||||
IF NEW.firstname <> OLD.firstname OR NEW.lastname <> OLD.lastname
|
||||
THEN
|
||||
UPDATE chill_person_person
|
||||
SET fullnameCanonical=LOWER(UNACCENT(CONCAT(NEW.firstname, ' ', NEW.lastname)))
|
||||
WHERE id=NEW.id;
|
||||
END IF;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$BODY$ LANGUAGE PLPGSQL;
|
||||
SQL
|
||||
);
|
||||
$this->addSql(
|
||||
<<<'SQL'
|
||||
CREATE TRIGGER canonicalize_fullname_on_update
|
||||
AFTER UPDATE
|
||||
ON chill_person_person
|
||||
FOR EACH ROW
|
||||
WHEN (pg_trigger_depth() = 0)
|
||||
EXECUTE PROCEDURE canonicalize_fullname_on_update();
|
||||
SQL
|
||||
);
|
||||
|
||||
$this->addSql(
|
||||
<<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION canonicalize_fullname_on_insert() RETURNS TRIGGER AS
|
||||
$BODY$
|
||||
BEGIN
|
||||
UPDATE chill_person_person
|
||||
SET fullnameCanonical=LOWER(UNACCENT(CONCAT(NEW.firstname, ' ', NEW.lastname)))
|
||||
WHERE id=NEW.id;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$BODY$ LANGUAGE PLPGSQL;
|
||||
SQL
|
||||
);
|
||||
$this->addSql(
|
||||
<<<'SQL'
|
||||
CREATE TRIGGER canonicalize_fullname_on_insert
|
||||
AFTER INSERT
|
||||
ON chill_person_person
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE canonicalize_fullname_on_insert();
|
||||
SQL
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,13 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?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\Person;
|
||||
|
||||
@@ -6,19 +15,19 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add a link between accompanying periods and users
|
||||
* Add a link between accompanying periods and users.
|
||||
*/
|
||||
final class Version20190701124238 extends AbstractMigration
|
||||
{
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD user_id INT DEFAULT NULL;');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD CONSTRAINT FK_E260A868A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE;');
|
||||
$this->addSql('CREATE INDEX IDX_E260A868A76ED395 ON chill_person_accompanying_period (user_id);');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP user_id');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP user_id');
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD user_id INT DEFAULT NULL;');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD CONSTRAINT FK_E260A868A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE;');
|
||||
$this->addSql('CREATE INDEX IDX_E260A868A76ED395 ON chill_person_accompanying_period (user_id);');
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,13 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?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\Person;
|
||||
|
||||
@@ -6,25 +15,24 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add an index for phonenumber and mobile number
|
||||
* Add an index for phonenumber and mobile number.
|
||||
*/
|
||||
final class Version20191106103452 extends AbstractMigration
|
||||
{
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql("CREATE INDEX phonenumber_trgm_idx
|
||||
ON public.chill_person_person USING gin
|
||||
(phonenumber gin_trgm_ops)");
|
||||
|
||||
$this->addSql("CREATE INDEX mobilenumber_trgm_idx
|
||||
ON public.chill_person_person USING gin
|
||||
(mobilenumber gin_trgm_ops)");
|
||||
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql("DROP INDEX phonenumber_trgm_idx");
|
||||
$this->addSql("DROP INDEX mobilenumber_trgm_idx");
|
||||
$this->addSql('DROP INDEX phonenumber_trgm_idx');
|
||||
$this->addSql('DROP INDEX mobilenumber_trgm_idx');
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE INDEX phonenumber_trgm_idx
|
||||
ON public.chill_person_person USING gin
|
||||
(phonenumber gin_trgm_ops)');
|
||||
|
||||
$this->addSql('CREATE INDEX mobilenumber_trgm_idx
|
||||
ON public.chill_person_person USING gin
|
||||
(mobilenumber gin_trgm_ops)');
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,13 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?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\Person;
|
||||
|
||||
@@ -6,26 +15,26 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add person alt name table
|
||||
* Add person alt name table.
|
||||
*/
|
||||
final class Version20200128084445 extends AbstractMigration
|
||||
{
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql("CREATE SEQUENCE chill_person_alt_name_id_seq INCREMENT BY 1 MINVALUE 1 START 1");
|
||||
$this->addSql("CREATE TABLE chill_person_alt_name (id INT NOT NULL, person_id INT DEFAULT NULL, key VARCHAR(255) NOT NULL, label TEXT NOT NULL, PRIMARY KEY(id))");
|
||||
$this->addSql("CREATE INDEX IDX_2628668E217BBB47 ON chill_person_alt_name (person_id)");
|
||||
$this->addSql("ALTER TABLE chill_person_alt_name ADD CONSTRAINT FK_2628668E217BBB47 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("DROP INDEX IDX_2628668E217BBB47");
|
||||
$this->addSql("DROP TABLE chill_person_alt_name");
|
||||
$this->addSql("DROP SEQUENCE chill_person_alt_name_id_seq");
|
||||
$this->addSql('DROP INDEX IDX_2628668E217BBB47');
|
||||
$this->addSql('DROP TABLE chill_person_alt_name');
|
||||
$this->addSql('DROP SEQUENCE chill_person_alt_name_id_seq');
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('CREATE SEQUENCE chill_person_alt_name_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE TABLE chill_person_alt_name (id INT NOT NULL, person_id INT DEFAULT NULL, key VARCHAR(255) NOT NULL, label TEXT NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX IDX_2628668E217BBB47 ON chill_person_alt_name (person_id)');
|
||||
$this->addSql('ALTER TABLE chill_person_alt_name ADD CONSTRAINT FK_2628668E217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,13 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?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\Person;
|
||||
|
||||
@@ -6,149 +15,148 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add triggers for canicalizing alt names
|
||||
* Add triggers for canicalizing alt names.
|
||||
*/
|
||||
final class Version20200130213446 extends AbstractMigration
|
||||
{
|
||||
const CANONICALIZE_FULLNAME_ON_UPDATE = <<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION public.canonicalize_fullname_on_update()
|
||||
RETURNS trigger
|
||||
LANGUAGE 'plpgsql'
|
||||
COST 100
|
||||
VOLATILE NOT LEAKPROOF
|
||||
AS $BODY$
|
||||
DECLARE
|
||||
cur_alt_names CURSOR(pid INTEGER) FOR SELECT label FROM chill_person_alt_name WHERE person_id = pid;
|
||||
alt_name RECORD;
|
||||
fullname_canonicalized TEXT;
|
||||
BEGIN
|
||||
fullname_canonicalized := LOWER(UNACCENT(CONCAT(NEW.firstname, ' ', NEW.lastname)));
|
||||
OPEN cur_alt_names(pid:=NEW.id);
|
||||
LOOP
|
||||
FETCH cur_alt_names INTO alt_name;
|
||||
public const CANONICALIZE_FULLNAME_ON_ALT_NAME_ALTER = <<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION public.canonicalize_fullname_on_alt_name_alter()
|
||||
RETURNS trigger
|
||||
LANGUAGE 'plpgsql'
|
||||
COST 100
|
||||
VOLATILE NOT LEAKPROOF
|
||||
AS $BODY$
|
||||
DECLARE
|
||||
target_person_id INTEGER;
|
||||
cur_person CURSOR(pid INTEGER) FOR SELECT firstname, lastname FROM chill_person_person WHERE id = pid;
|
||||
person RECORD;
|
||||
cur_alt_names CURSOR(pid INTEGER) FOR SELECT label FROM chill_person_alt_name WHERE person_id = pid;
|
||||
alt_name RECORD;
|
||||
fullname_canonicalized TEXT;
|
||||
BEGIN
|
||||
IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE'
|
||||
THEN target_person_id := NEW.person_id;
|
||||
ELSE target_person_id := OLD.person_id;
|
||||
END IF;
|
||||
|
||||
EXIT WHEN NOT FOUND;
|
||||
OPEN cur_person(pid:=target_person_id);
|
||||
FETCH cur_person INTO person;
|
||||
fullname_canonicalized := LOWER(UNACCENT(CONCAT(person.firstname, ' ', person.lastname)));
|
||||
-- loop over alt names
|
||||
OPEN cur_alt_names(pid:=target_person_id);
|
||||
LOOP
|
||||
FETCH cur_alt_names INTO alt_name;
|
||||
|
||||
fullname_canonicalized := CONCAT(fullname_canonicalized, ' ',
|
||||
LOWER(UNACCENT(alt_name.label)));
|
||||
END LOOP;
|
||||
CLOSE cur_alt_names;
|
||||
EXIT WHEN NOT FOUND;
|
||||
|
||||
IF fullname_canonicalized <> OLD.fullnameCanonical
|
||||
THEN
|
||||
UPDATE chill_person_person
|
||||
SET fullnameCanonical=fullname_canonicalized
|
||||
WHERE id=NEW.id;
|
||||
END IF;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$BODY$;
|
||||
SQL;
|
||||
|
||||
const CANONICALIZE_FULLNAME_ON_ALT_NAME_ALTER = <<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION public.canonicalize_fullname_on_alt_name_alter()
|
||||
RETURNS trigger
|
||||
LANGUAGE 'plpgsql'
|
||||
COST 100
|
||||
VOLATILE NOT LEAKPROOF
|
||||
AS $BODY$
|
||||
DECLARE
|
||||
target_person_id INTEGER;
|
||||
cur_person CURSOR(pid INTEGER) FOR SELECT firstname, lastname FROM chill_person_person WHERE id = pid;
|
||||
person RECORD;
|
||||
cur_alt_names CURSOR(pid INTEGER) FOR SELECT label FROM chill_person_alt_name WHERE person_id = pid;
|
||||
alt_name RECORD;
|
||||
fullname_canonicalized TEXT;
|
||||
BEGIN
|
||||
IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE'
|
||||
THEN target_person_id := NEW.person_id;
|
||||
ELSE target_person_id := OLD.person_id;
|
||||
END IF;
|
||||
fullname_canonicalized := CONCAT(fullname_canonicalized, ' ',
|
||||
LOWER(UNACCENT(alt_name.label)));
|
||||
END LOOP;
|
||||
CLOSE cur_alt_names;
|
||||
CLOSE cur_person;
|
||||
|
||||
OPEN cur_person(pid:=target_person_id);
|
||||
FETCH cur_person INTO person;
|
||||
fullname_canonicalized := LOWER(UNACCENT(CONCAT(person.firstname, ' ', person.lastname)));
|
||||
-- loop over alt names
|
||||
OPEN cur_alt_names(pid:=target_person_id);
|
||||
LOOP
|
||||
FETCH cur_alt_names INTO alt_name;
|
||||
UPDATE chill_person_person
|
||||
SET fullnameCanonical=fullname_canonicalized
|
||||
WHERE id=target_person_id;
|
||||
|
||||
EXIT WHEN NOT FOUND;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$BODY$;
|
||||
SQL;
|
||||
|
||||
fullname_canonicalized := CONCAT(fullname_canonicalized, ' ',
|
||||
LOWER(UNACCENT(alt_name.label)));
|
||||
END LOOP;
|
||||
CLOSE cur_alt_names;
|
||||
CLOSE cur_person;
|
||||
public const CANONICALIZE_FULLNAME_ON_ALT_NAME_DELETE = <<<'SQL'
|
||||
CREATE TRIGGER canonicalize_fullname_on_alt_name_delete
|
||||
AFTER DELETE
|
||||
ON chill_person_alt_name
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE canonicalize_fullname_on_alt_name_alter();
|
||||
SQL;
|
||||
|
||||
UPDATE chill_person_person
|
||||
SET fullnameCanonical=fullname_canonicalized
|
||||
WHERE id=target_person_id;
|
||||
public const CANONICALIZE_FULLNAME_ON_ALT_NAME_INSERT = <<<'SQL'
|
||||
CREATE TRIGGER canonicalize_fullname_on_alt_name_insert
|
||||
AFTER INSERT
|
||||
ON chill_person_alt_name
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE canonicalize_fullname_on_alt_name_alter();
|
||||
SQL;
|
||||
|
||||
RETURN NEW;
|
||||
END;
|
||||
$BODY$;
|
||||
SQL;
|
||||
|
||||
const CANONICALIZE_FULLNAME_ON_ALT_NAME_INSERT = <<<SQL
|
||||
CREATE TRIGGER canonicalize_fullname_on_alt_name_insert
|
||||
AFTER INSERT
|
||||
ON chill_person_alt_name
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE canonicalize_fullname_on_alt_name_alter();
|
||||
SQL;
|
||||
|
||||
const CANONICALIZE_FULLNAME_ON_ALT_NAME_DELETE = <<<SQL
|
||||
CREATE TRIGGER canonicalize_fullname_on_alt_name_delete
|
||||
AFTER DELETE
|
||||
ON chill_person_alt_name
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE canonicalize_fullname_on_alt_name_alter();
|
||||
SQL;
|
||||
public const CANONICALIZE_FULLNAME_ON_ALT_NAME_UPDATE = <<<'SQL'
|
||||
CREATE TRIGGER canonicalize_fullname_on_alt_name_update
|
||||
AFTER UPDATE
|
||||
ON chill_person_alt_name
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE canonicalize_fullname_on_alt_name_alter();
|
||||
SQL;
|
||||
|
||||
public const CANONICALIZE_FULLNAME_ON_UPDATE = <<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION public.canonicalize_fullname_on_update()
|
||||
RETURNS trigger
|
||||
LANGUAGE 'plpgsql'
|
||||
COST 100
|
||||
VOLATILE NOT LEAKPROOF
|
||||
AS $BODY$
|
||||
DECLARE
|
||||
cur_alt_names CURSOR(pid INTEGER) FOR SELECT label FROM chill_person_alt_name WHERE person_id = pid;
|
||||
alt_name RECORD;
|
||||
fullname_canonicalized TEXT;
|
||||
BEGIN
|
||||
fullname_canonicalized := LOWER(UNACCENT(CONCAT(NEW.firstname, ' ', NEW.lastname)));
|
||||
OPEN cur_alt_names(pid:=NEW.id);
|
||||
LOOP
|
||||
FETCH cur_alt_names INTO alt_name;
|
||||
|
||||
EXIT WHEN NOT FOUND;
|
||||
|
||||
fullname_canonicalized := CONCAT(fullname_canonicalized, ' ',
|
||||
LOWER(UNACCENT(alt_name.label)));
|
||||
END LOOP;
|
||||
CLOSE cur_alt_names;
|
||||
|
||||
IF fullname_canonicalized <> OLD.fullnameCanonical
|
||||
THEN
|
||||
UPDATE chill_person_person
|
||||
SET fullnameCanonical=fullname_canonicalized
|
||||
WHERE id=NEW.id;
|
||||
END IF;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$BODY$;
|
||||
SQL;
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP TRIGGER canonicalize_fullname_on_alt_name_update ON chill_person_alt_name;');
|
||||
$this->addSql('DROP TRIGGER canonicalize_fullname_on_alt_name_insert ON chill_person_alt_name;');
|
||||
$this->addSql('DROP TRIGGER canonicalize_fullname_on_alt_name_delete ON chill_person_alt_name;');
|
||||
$this->addSql('DROP FUNCTION canonicalize_fullname_on_alt_name_alter();');
|
||||
$this->addSql(
|
||||
<<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION canonicalize_fullname_on_update() RETURNS TRIGGER AS
|
||||
$BODY$
|
||||
BEGIN
|
||||
IF NEW.firstname <> OLD.firstname OR NEW.lastname <> OLD.lastname
|
||||
THEN
|
||||
UPDATE chill_person_person
|
||||
SET fullnameCanonical=LOWER(UNACCENT(CONCAT(NEW.firstname, ' ', NEW.lastname)))
|
||||
WHERE id=NEW.id;
|
||||
END IF;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$BODY$ LANGUAGE PLPGSQL;
|
||||
SQL
|
||||
);
|
||||
}
|
||||
|
||||
const CANONICALIZE_FULLNAME_ON_ALT_NAME_UPDATE = <<<SQL
|
||||
CREATE TRIGGER canonicalize_fullname_on_alt_name_update
|
||||
AFTER UPDATE
|
||||
ON chill_person_alt_name
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE canonicalize_fullname_on_alt_name_alter();
|
||||
SQL;
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// update fullname
|
||||
$this->addSql("ALTER TABLE chill_person_person ALTER fullnamecanonical TYPE TEXT;");
|
||||
$this->addSql("ALTER TABLE chill_person_person ALTER fullnamecanonical DROP DEFAULT;");
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER fullnamecanonical TYPE TEXT;');
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER fullnamecanonical DROP DEFAULT;');
|
||||
// insert function and triggers
|
||||
$this->addSql(self::CANONICALIZE_FULLNAME_ON_UPDATE);
|
||||
$this->addSql(self::CANONICALIZE_FULLNAME_ON_ALT_NAME_ALTER);
|
||||
$this->addSql(self::CANONICALIZE_FULLNAME_ON_ALT_NAME_INSERT);
|
||||
$this->addSql(self::CANONICALIZE_FULLNAME_ON_ALT_NAME_DELETE);
|
||||
$this->addSql(self::CANONICALIZE_FULLNAME_ON_ALT_NAME_UPDATE);
|
||||
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql("DROP TRIGGER canonicalize_fullname_on_alt_name_update ON chill_person_alt_name;");
|
||||
$this->addSql("DROP TRIGGER canonicalize_fullname_on_alt_name_insert ON chill_person_alt_name;");
|
||||
$this->addSql("DROP TRIGGER canonicalize_fullname_on_alt_name_delete ON chill_person_alt_name;");
|
||||
$this->addSql("DROP FUNCTION canonicalize_fullname_on_alt_name_alter();");
|
||||
$this->addSql(<<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION canonicalize_fullname_on_update() RETURNS TRIGGER AS
|
||||
$BODY$
|
||||
BEGIN
|
||||
IF NEW.firstname <> OLD.firstname OR NEW.lastname <> OLD.lastname
|
||||
THEN
|
||||
UPDATE chill_person_person
|
||||
SET fullnameCanonical=LOWER(UNACCENT(CONCAT(NEW.firstname, ' ', NEW.lastname)))
|
||||
WHERE id=NEW.id;
|
||||
END IF;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$BODY$ LANGUAGE PLPGSQL;
|
||||
SQL
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,4 +1,13 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?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\Person;
|
||||
|
||||
@@ -6,10 +15,18 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add a relationship parent/child inside closing motives
|
||||
* Add a relationship parent/child inside closing motives.
|
||||
*/
|
||||
final class Version20200310090632 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('ALTER TABLE chill_person_closingmotive DROP parent_id');
|
||||
$this->addSql('ALTER TABLE chill_person_closingmotive DROP ordering');
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
@@ -19,12 +36,4 @@ final class Version20200310090632 extends AbstractMigration
|
||||
$this->addSql('CREATE INDEX IDX_92351ECE727ACA70 ON chill_person_closingmotive (parent_id)');
|
||||
$this->addsql("ALTER TABLE chill_person_closingmotive ADD ordering DOUBLE PRECISION DEFAULT '0' NOT NULL;");
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_closingmotive DROP parent_id');
|
||||
$this->addSql('ALTER TABLE chill_person_closingmotive DROP ordering');
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,13 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?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\Person;
|
||||
|
||||
@@ -10,129 +19,130 @@ use Doctrine\Migrations\AbstractMigration;
|
||||
*/
|
||||
final class Version20200422125935 extends AbstractMigration
|
||||
{
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP FUNCTION get_last_address(integer, date)');
|
||||
$this->addSql(<<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION public.get_last_address (
|
||||
pid integer,
|
||||
before_date date)
|
||||
RETURNS TABLE(
|
||||
person_id integer,
|
||||
address_id integer,
|
||||
streetaddress1 varchar(255),
|
||||
streetaddress2 varchar(255),
|
||||
validfrom date,
|
||||
postcode_label varchar(255),
|
||||
postcode_code varchar(100),
|
||||
postcode_id integer,
|
||||
isnoaddress boolean,
|
||||
country_name json,
|
||||
country_code varchar(3),
|
||||
country_id integer)
|
||||
AS
|
||||
$BODY$
|
||||
SELECT
|
||||
pid AS person_id,
|
||||
chill_main_address.id AS address_id,
|
||||
chill_main_address.streetaddress1,
|
||||
chill_main_address.streetaddress2,
|
||||
chill_main_address.validfrom,
|
||||
chill_main_postal_code.label,
|
||||
chill_main_postal_code.code,
|
||||
chill_main_postal_code.id AS postal_code_id,
|
||||
chill_main_address.isnoaddress AS isnoaddress,
|
||||
country.name,
|
||||
country.countrycode,
|
||||
country.id AS country_id
|
||||
FROM chill_main_address
|
||||
JOIN (
|
||||
SELECT
|
||||
chill_main_address.id AS address_id,
|
||||
validfrom,
|
||||
rank() OVER (PARTITION BY person_id ORDER BY validfrom DESC) as pos
|
||||
FROM chill_person_persons_to_addresses
|
||||
JOIN chill_main_address ON chill_person_persons_to_addresses.address_id = chill_main_address.id
|
||||
WHERE person_id = pid
|
||||
AND chill_main_address.validfrom <= before_date
|
||||
) AS ranking ON ranking.address_id = chill_main_address.id
|
||||
JOIN chill_main_postal_code ON chill_main_address.postcode_id = chill_main_postal_code.id
|
||||
JOIN country ON chill_main_postal_code.country_id = country.id
|
||||
WHERE ranking.pos = 1
|
||||
$BODY$
|
||||
LANGUAGE sql VOLATILE
|
||||
COST 100;
|
||||
SQL
|
||||
);
|
||||
|
||||
$this->addSql(<<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION get_last_address_isnoaddress (
|
||||
pid integer,
|
||||
before_date date)
|
||||
RETURNS BOOL AS
|
||||
$BODY$
|
||||
SELECT isnoaddress FROM get_last_address(pid, before_date)
|
||||
$BODY$
|
||||
LANGUAGE sql volatile
|
||||
COST 100;
|
||||
SQL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP FUNCTION public.get_last_address_isnoaddress(integer, date);');
|
||||
$this->addSql('DROP FUNCTION get_last_address(integer, date)');
|
||||
$this->addSql(<<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION public.get_last_address (
|
||||
pid integer,
|
||||
before_date date)
|
||||
RETURNS TABLE(
|
||||
person_id integer,
|
||||
address_id integer,
|
||||
streetaddress1 varchar(255),
|
||||
streetaddress2 varchar(255),
|
||||
validfrom date,
|
||||
postcode_label varchar(255),
|
||||
postcode_code varchar(100),
|
||||
postcode_id integer,
|
||||
country_name json,
|
||||
country_code varchar(3),
|
||||
country_id integer)
|
||||
AS
|
||||
$BODY$
|
||||
SELECT
|
||||
pid AS person_id,
|
||||
chill_main_address.id AS address_id,
|
||||
chill_main_address.streetaddress1,
|
||||
chill_main_address.streetaddress2,
|
||||
chill_main_address.validfrom,
|
||||
chill_main_postal_code.label,
|
||||
chill_main_postal_code.code,
|
||||
chill_main_postal_code.id AS postal_code_id,
|
||||
country.name,
|
||||
country.countrycode,
|
||||
country.id AS country_id
|
||||
FROM chill_main_address
|
||||
JOIN (
|
||||
SELECT
|
||||
chill_main_address.id AS address_id,
|
||||
validfrom,
|
||||
rank() OVER (PARTITION BY person_id ORDER BY validfrom DESC) as pos
|
||||
FROM chill_person_persons_to_addresses
|
||||
JOIN chill_main_address ON chill_person_persons_to_addresses.address_id = chill_main_address.id
|
||||
WHERE person_id = pid
|
||||
AND chill_main_address.validfrom <= before_date
|
||||
) AS ranking ON ranking.address_id = chill_main_address.id
|
||||
JOIN chill_main_postal_code ON chill_main_address.postcode_id = chill_main_postal_code.id
|
||||
JOIN country ON chill_main_postal_code.country_id = country.id
|
||||
WHERE ranking.pos = 1
|
||||
$BODY$
|
||||
LANGUAGE sql VOLATILE
|
||||
COST 100;
|
||||
SQL
|
||||
$this->addSql(
|
||||
<<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION public.get_last_address (
|
||||
pid integer,
|
||||
before_date date)
|
||||
RETURNS TABLE(
|
||||
person_id integer,
|
||||
address_id integer,
|
||||
streetaddress1 varchar(255),
|
||||
streetaddress2 varchar(255),
|
||||
validfrom date,
|
||||
postcode_label varchar(255),
|
||||
postcode_code varchar(100),
|
||||
postcode_id integer,
|
||||
country_name json,
|
||||
country_code varchar(3),
|
||||
country_id integer)
|
||||
AS
|
||||
$BODY$
|
||||
SELECT
|
||||
pid AS person_id,
|
||||
chill_main_address.id AS address_id,
|
||||
chill_main_address.streetaddress1,
|
||||
chill_main_address.streetaddress2,
|
||||
chill_main_address.validfrom,
|
||||
chill_main_postal_code.label,
|
||||
chill_main_postal_code.code,
|
||||
chill_main_postal_code.id AS postal_code_id,
|
||||
country.name,
|
||||
country.countrycode,
|
||||
country.id AS country_id
|
||||
FROM chill_main_address
|
||||
JOIN (
|
||||
SELECT
|
||||
chill_main_address.id AS address_id,
|
||||
validfrom,
|
||||
rank() OVER (PARTITION BY person_id ORDER BY validfrom DESC) as pos
|
||||
FROM chill_person_persons_to_addresses
|
||||
JOIN chill_main_address ON chill_person_persons_to_addresses.address_id = chill_main_address.id
|
||||
WHERE person_id = pid
|
||||
AND chill_main_address.validfrom <= before_date
|
||||
) AS ranking ON ranking.address_id = chill_main_address.id
|
||||
JOIN chill_main_postal_code ON chill_main_address.postcode_id = chill_main_postal_code.id
|
||||
JOIN country ON chill_main_postal_code.country_id = country.id
|
||||
WHERE ranking.pos = 1
|
||||
$BODY$
|
||||
LANGUAGE sql VOLATILE
|
||||
COST 100;
|
||||
SQL
|
||||
);
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP FUNCTION get_last_address(integer, date)');
|
||||
$this->addSql(
|
||||
<<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION public.get_last_address (
|
||||
pid integer,
|
||||
before_date date)
|
||||
RETURNS TABLE(
|
||||
person_id integer,
|
||||
address_id integer,
|
||||
streetaddress1 varchar(255),
|
||||
streetaddress2 varchar(255),
|
||||
validfrom date,
|
||||
postcode_label varchar(255),
|
||||
postcode_code varchar(100),
|
||||
postcode_id integer,
|
||||
isnoaddress boolean,
|
||||
country_name json,
|
||||
country_code varchar(3),
|
||||
country_id integer)
|
||||
AS
|
||||
$BODY$
|
||||
SELECT
|
||||
pid AS person_id,
|
||||
chill_main_address.id AS address_id,
|
||||
chill_main_address.streetaddress1,
|
||||
chill_main_address.streetaddress2,
|
||||
chill_main_address.validfrom,
|
||||
chill_main_postal_code.label,
|
||||
chill_main_postal_code.code,
|
||||
chill_main_postal_code.id AS postal_code_id,
|
||||
chill_main_address.isnoaddress AS isnoaddress,
|
||||
country.name,
|
||||
country.countrycode,
|
||||
country.id AS country_id
|
||||
FROM chill_main_address
|
||||
JOIN (
|
||||
SELECT
|
||||
chill_main_address.id AS address_id,
|
||||
validfrom,
|
||||
rank() OVER (PARTITION BY person_id ORDER BY validfrom DESC) as pos
|
||||
FROM chill_person_persons_to_addresses
|
||||
JOIN chill_main_address ON chill_person_persons_to_addresses.address_id = chill_main_address.id
|
||||
WHERE person_id = pid
|
||||
AND chill_main_address.validfrom <= before_date
|
||||
) AS ranking ON ranking.address_id = chill_main_address.id
|
||||
JOIN chill_main_postal_code ON chill_main_address.postcode_id = chill_main_postal_code.id
|
||||
JOIN country ON chill_main_postal_code.country_id = country.id
|
||||
WHERE ranking.pos = 1
|
||||
$BODY$
|
||||
LANGUAGE sql VOLATILE
|
||||
COST 100;
|
||||
SQL
|
||||
);
|
||||
|
||||
$this->addSql(
|
||||
<<<'SQL'
|
||||
CREATE OR REPLACE FUNCTION get_last_address_isnoaddress (
|
||||
pid integer,
|
||||
before_date date)
|
||||
RETURNS BOOL AS
|
||||
$BODY$
|
||||
SELECT isnoaddress FROM get_last_address(pid, before_date)
|
||||
$BODY$
|
||||
LANGUAGE sql volatile
|
||||
COST 100;
|
||||
SQL
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -12,12 +19,19 @@ use Doctrine\Migrations\AbstractMigration;
|
||||
*/
|
||||
final class Version20210128152747 extends AbstractMigration
|
||||
{
|
||||
public function getDescription() : string
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP SEQUENCE chill_person_not_duplicate_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_person_not_duplicate');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema) : void
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SEQUENCE chill_person_not_duplicate_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
@@ -29,11 +43,4 @@ final class Version20210128152747 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_not_duplicate ADD CONSTRAINT FK_BD211EE22C402DF5 FOREIGN KEY (person2_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_not_duplicate ADD CONSTRAINT FK_BD211EE2A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP SEQUENCE chill_person_not_duplicate_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_person_not_duplicate');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -12,12 +19,19 @@ use Doctrine\Migrations\AbstractMigration;
|
||||
*/
|
||||
final class Version20210318095831 extends AbstractMigration
|
||||
{
|
||||
public function getDescription() : string
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP SEQUENCE chill_person_phone_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_person_phone');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema) : void
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
|
||||
@@ -26,11 +40,4 @@ final class Version20210318095831 extends AbstractMigration
|
||||
$this->addSql('CREATE INDEX IDX_72C1F87217BBB47 ON chill_person_phone (person_id)');
|
||||
$this->addSql('ALTER TABLE chill_person_phone ADD CONSTRAINT FK_72C1F87217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP SEQUENCE chill_person_phone_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_person_phone');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -12,20 +19,20 @@ use Doctrine\Migrations\AbstractMigration;
|
||||
*/
|
||||
final class Version20210325141540 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 chill_person_phone ADD type TEXT DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your need
|
||||
$this->addSql('ALTER TABLE chill_person_phone DROP type');
|
||||
}
|
||||
|
||||
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 chill_person_phone ADD type TEXT DEFAULT NULL');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -9,46 +16,17 @@ use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Change model relation between Person and AccompagnyingPeriod
|
||||
* Migrate datas into new join table
|
||||
*
|
||||
* @author Mathieu Jaumotte mathieu.jaumotte@champs-libres.coop
|
||||
* Migrate datas into new join table.
|
||||
*/
|
||||
final class Version20210326113045 extends AbstractMigration
|
||||
{
|
||||
private $datas = [];
|
||||
|
||||
public function getDescription() : string
|
||||
{
|
||||
return 'Change model relation between Person and AccompagnyingPeriod, without losing datas when going up';
|
||||
}
|
||||
|
||||
/**
|
||||
* In these direction, there is no loss.
|
||||
*/
|
||||
public function up(Schema $schema) : void
|
||||
{
|
||||
// create join table
|
||||
$this->addSql('CREATE TABLE persons_accompanying_periods (person_id INT NOT NULL, accompanyingperiod_id INT NOT NULL, PRIMARY KEY(person_id, accompanyingperiod_id))');
|
||||
$this->addSql('CREATE INDEX IDX_49A3871F217BBB47 ON persons_accompanying_periods (person_id)');
|
||||
$this->addSql('CREATE INDEX IDX_49A3871F550B0C53 ON persons_accompanying_periods (accompanyingperiod_id)');
|
||||
$this->addSql('ALTER TABLE persons_accompanying_periods ADD CONSTRAINT FK_49A3871F217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE persons_accompanying_periods ADD CONSTRAINT FK_49A3871F550B0C53 FOREIGN KEY (accompanyingperiod_id) REFERENCES chill_person_accompanying_period (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
|
||||
// insert datas in new join table
|
||||
$this->addSql('INSERT INTO persons_accompanying_periods (person_id, accompanyingperiod_id) '
|
||||
. 'SELECT person_id, id as accompagnying_period_id FROM chill_person_accompanying_period WHERE person_id IS NOT NULL');
|
||||
|
||||
// drop column
|
||||
$this->addSql('DROP INDEX idx_64a4a621217bbb47');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP CONSTRAINT fk_64a4a621217bbb47');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP person_id');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The distinct clause makes that for each group of duplicates, it keeps only the first row in the returned result set.
|
||||
* Then we have only few lost datas. Lost datas: when many persons for one AccompanyingPeriod (keep only first person)
|
||||
* Then we have only few lost datas. Lost datas: when many persons for one AccompanyingPeriod (keep only first person).
|
||||
*/
|
||||
public function down(Schema $schema) : void
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// add column
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD person_id INT DEFAULT NULL');
|
||||
@@ -59,12 +37,39 @@ final class Version20210326113045 extends AbstractMigration
|
||||
$this->addSql('UPDATE chill_person_accompanying_period AS ap '
|
||||
. 'SET person_id = jt.person_id '
|
||||
. 'FROM ( '
|
||||
. 'SELECT DISTINCT ON (accompanyingperiod_id) accompanyingperiod_id AS id, person_id FROM persons_accompanying_periods '
|
||||
. 'ORDER BY id, person_id ASC '
|
||||
. 'SELECT DISTINCT ON (accompanyingperiod_id) accompanyingperiod_id AS id, person_id FROM persons_accompanying_periods '
|
||||
. 'ORDER BY id, person_id ASC '
|
||||
. ') AS jt '
|
||||
. 'WHERE ap.id = jt.id');
|
||||
|
||||
|
||||
// drop join table
|
||||
$this->addSql('DROP TABLE persons_accompanying_periods');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Change model relation between Person and AccompagnyingPeriod, without losing datas when going up';
|
||||
}
|
||||
|
||||
/**
|
||||
* In these direction, there is no loss.
|
||||
*/
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// create join table
|
||||
$this->addSql('CREATE TABLE persons_accompanying_periods (person_id INT NOT NULL, accompanyingperiod_id INT NOT NULL, PRIMARY KEY(person_id, accompanyingperiod_id))');
|
||||
$this->addSql('CREATE INDEX IDX_49A3871F217BBB47 ON persons_accompanying_periods (person_id)');
|
||||
$this->addSql('CREATE INDEX IDX_49A3871F550B0C53 ON persons_accompanying_periods (accompanyingperiod_id)');
|
||||
$this->addSql('ALTER TABLE persons_accompanying_periods ADD CONSTRAINT FK_49A3871F217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE persons_accompanying_periods ADD CONSTRAINT FK_49A3871F550B0C53 FOREIGN KEY (accompanyingperiod_id) REFERENCES chill_person_accompanying_period (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
|
||||
// insert datas in new join table
|
||||
$this->addSql('INSERT INTO persons_accompanying_periods (person_id, accompanyingperiod_id) '
|
||||
. 'SELECT person_id, id as accompagnying_period_id FROM chill_person_accompanying_period WHERE person_id IS NOT NULL');
|
||||
|
||||
// drop column
|
||||
$this->addSql('DROP INDEX idx_64a4a621217bbb47');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP CONSTRAINT fk_64a4a621217bbb47');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP person_id');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,38 +15,34 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add AccompanyingPeriod Origin table
|
||||
*
|
||||
* @author Mathieu Jaumotte mathieu.jaumotte@champs-libres.coop
|
||||
* Add AccompanyingPeriod Origin table.
|
||||
*/
|
||||
final class Version20210329090904 extends AbstractMigration
|
||||
{
|
||||
public function getDescription() : string
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP CONSTRAINT FK_E260A86856A273CC');
|
||||
|
||||
$this->addSql('DROP SEQUENCE chill_person_accompanying_period_origin_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_origin');
|
||||
|
||||
$this->addSql('DROP INDEX IDX_E260A86856A273CC');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP origin_id');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add AccompanyingPeriod Origin table';
|
||||
}
|
||||
|
||||
public function up(Schema $schema) : void
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE SEQUENCE chill_person_accompanying_period_origin_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE TABLE chill_person_accompanying_period_origin (id INT NOT NULL, label VARCHAR(255) NOT NULL, noActiveAfter DATE DEFAULT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_origin.noActiveAfter IS \'(DC2Type:date_immutable)\'');
|
||||
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD origin_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD CONSTRAINT FK_E260A86856A273CC FOREIGN KEY (origin_id) REFERENCES chill_person_accompanying_period_origin (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX IDX_E260A86856A273CC ON chill_person_accompanying_period (origin_id)');
|
||||
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP CONSTRAINT FK_E260A86856A273CC');
|
||||
|
||||
$this->addSql('DROP SEQUENCE chill_person_accompanying_period_origin_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_origin');
|
||||
|
||||
$this->addSql('DROP INDEX IDX_E260A86856A273CC');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP origin_id');
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,53 +15,48 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add AccompanyingPeriod Comment and Resource tables
|
||||
*
|
||||
* @author Mathieu Jaumotte mathieu.jaumotte@champs-libres.coop
|
||||
* Add AccompanyingPeriod Comment and Resource tables.
|
||||
*/
|
||||
final class Version20210329113152 extends AbstractMigration
|
||||
{
|
||||
public function getDescription() : string
|
||||
{
|
||||
return 'Add AccompanyingPeriod Comment and Resource tables';
|
||||
}
|
||||
|
||||
public function up(Schema $schema) : void
|
||||
{
|
||||
$this->addSql('CREATE SEQUENCE chill_person_accompanying_period_comment_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE TABLE chill_person_accompanying_period_comment (id INT NOT NULL, creator_id INT NOT NULL, createdAt TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updatedAt TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, content TEXT NOT NULL, accompanyingPeriod_id INT NOT NULL, updatedBy_id INT NOT NULL, PRIMARY KEY(id))');
|
||||
|
||||
$this->addSql('CREATE INDEX IDX_CD960EF3D7FA8EF0 ON chill_person_accompanying_period_comment (accompanyingPeriod_id)');
|
||||
$this->addSql('CREATE INDEX IDX_CD960EF361220EA6 ON chill_person_accompanying_period_comment (creator_id)');
|
||||
$this->addSql('CREATE INDEX IDX_CD960EF365FF1AEC ON chill_person_accompanying_period_comment (updatedBy_id)');
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_comment ADD CONSTRAINT FK_CD960EF3D7FA8EF0 FOREIGN KEY (accompanyingPeriod_id) REFERENCES chill_person_accompanying_period (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_comment ADD CONSTRAINT FK_CD960EF361220EA6 FOREIGN KEY (creator_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_comment ADD CONSTRAINT FK_CD960EF365FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
|
||||
|
||||
$this->addSql('CREATE SEQUENCE chill_person_accompanying_period_resource_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE TABLE chill_person_accompanying_period_resource (id INT NOT NULL, person_id INT DEFAULT NULL, comment_id INT DEFAULT NULL, accompanyingPeriod_id INT NOT NULL, thirdParty_id INT DEFAULT NULL, PRIMARY KEY(id))');
|
||||
|
||||
$this->addSql('CREATE INDEX IDX_DC78989FD7FA8EF0 ON chill_person_accompanying_period_resource (accompanyingPeriod_id)');
|
||||
$this->addSql('CREATE INDEX IDX_DC78989F3EA5CAB0 ON chill_person_accompanying_period_resource (thirdParty_id)');
|
||||
$this->addSql('CREATE INDEX IDX_DC78989F217BBB47 ON chill_person_accompanying_period_resource (person_id)');
|
||||
$this->addSql('CREATE INDEX IDX_DC78989FF8697D13 ON chill_person_accompanying_period_resource (comment_id)');
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_resource ADD CONSTRAINT FK_DC78989FD7FA8EF0 FOREIGN KEY (accompanyingPeriod_id) REFERENCES chill_person_accompanying_period (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_resource ADD CONSTRAINT FK_DC78989F3EA5CAB0 FOREIGN KEY (thirdParty_id) REFERENCES chill_3party.third_party (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_resource ADD CONSTRAINT FK_DC78989F217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_resource ADD CONSTRAINT FK_DC78989FF8697D13 FOREIGN KEY (comment_id) REFERENCES chill_person_accompanying_period_comment (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP SEQUENCE chill_person_accompanying_period_resource_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_resource');
|
||||
|
||||
$this->addSql('DROP SEQUENCE chill_person_accompanying_period_comment_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_comment');
|
||||
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add AccompanyingPeriod Comment and Resource tables';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE SEQUENCE chill_person_accompanying_period_comment_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE TABLE chill_person_accompanying_period_comment (id INT NOT NULL, creator_id INT NOT NULL, createdAt TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updatedAt TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, content TEXT NOT NULL, accompanyingPeriod_id INT NOT NULL, updatedBy_id INT NOT NULL, PRIMARY KEY(id))');
|
||||
|
||||
$this->addSql('CREATE INDEX IDX_CD960EF3D7FA8EF0 ON chill_person_accompanying_period_comment (accompanyingPeriod_id)');
|
||||
$this->addSql('CREATE INDEX IDX_CD960EF361220EA6 ON chill_person_accompanying_period_comment (creator_id)');
|
||||
$this->addSql('CREATE INDEX IDX_CD960EF365FF1AEC ON chill_person_accompanying_period_comment (updatedBy_id)');
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_comment ADD CONSTRAINT FK_CD960EF3D7FA8EF0 FOREIGN KEY (accompanyingPeriod_id) REFERENCES chill_person_accompanying_period (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_comment ADD CONSTRAINT FK_CD960EF361220EA6 FOREIGN KEY (creator_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_comment ADD CONSTRAINT FK_CD960EF365FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
|
||||
$this->addSql('CREATE SEQUENCE chill_person_accompanying_period_resource_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE TABLE chill_person_accompanying_period_resource (id INT NOT NULL, person_id INT DEFAULT NULL, comment_id INT DEFAULT NULL, accompanyingPeriod_id INT NOT NULL, thirdParty_id INT DEFAULT NULL, PRIMARY KEY(id))');
|
||||
|
||||
$this->addSql('CREATE INDEX IDX_DC78989FD7FA8EF0 ON chill_person_accompanying_period_resource (accompanyingPeriod_id)');
|
||||
$this->addSql('CREATE INDEX IDX_DC78989F3EA5CAB0 ON chill_person_accompanying_period_resource (thirdParty_id)');
|
||||
$this->addSql('CREATE INDEX IDX_DC78989F217BBB47 ON chill_person_accompanying_period_resource (person_id)');
|
||||
$this->addSql('CREATE INDEX IDX_DC78989FF8697D13 ON chill_person_accompanying_period_resource (comment_id)');
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_resource ADD CONSTRAINT FK_DC78989FD7FA8EF0 FOREIGN KEY (accompanyingPeriod_id) REFERENCES chill_person_accompanying_period (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_resource ADD CONSTRAINT FK_DC78989F3EA5CAB0 FOREIGN KEY (thirdParty_id) REFERENCES chill_3party.third_party (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_resource ADD CONSTRAINT FK_DC78989F217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_resource ADD CONSTRAINT FK_DC78989FF8697D13 FOREIGN KEY (comment_id) REFERENCES chill_person_accompanying_period_comment (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,59 +15,22 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Complete accompanying period table
|
||||
*
|
||||
* @author Mathieu Jaumotte mathieu.jaumotte@champs-libres.coop
|
||||
* Complete accompanying period table.
|
||||
*/
|
||||
final class Version20210329144338 extends AbstractMigration
|
||||
{
|
||||
public function getDescription() : string
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
return 'Complete AccompanyingPeriod table';
|
||||
}
|
||||
|
||||
public function up(Schema $schema) : void
|
||||
{
|
||||
$this->addSql('CREATE TABLE accompanying_periods_scopes (accompanying_period_id INT NOT NULL, scope_id INT NOT NULL, PRIMARY KEY(accompanying_period_id, scope_id))');
|
||||
|
||||
$this->addSql('CREATE INDEX IDX_87C4EAB032A7A428 ON accompanying_periods_scopes (accompanying_period_id)');
|
||||
$this->addSql('CREATE INDEX IDX_87C4EAB0682B5931 ON accompanying_periods_scopes (scope_id)');
|
||||
|
||||
$this->addSql('ALTER TABLE accompanying_periods_scopes ADD CONSTRAINT FK_87C4EAB032A7A428 FOREIGN KEY (accompanying_period_id) REFERENCES chill_person_accompanying_period (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE accompanying_periods_scopes ADD CONSTRAINT FK_87C4EAB0682B5931 FOREIGN KEY (scope_id) REFERENCES scopes (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD step VARCHAR(32) DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD intensity VARCHAR(255) DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD createdBy_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD requestorPerson_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD requestorThirdParty_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD requestorAnonymous BOOLEAN NOT NULL DEFAULT \'false\'');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD emergency BOOLEAN NOT NULL DEFAULT \'false\'');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD confidential BOOLEAN NOT NULL DEFAULT \'false\'');
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD CONSTRAINT FK_E260A8683174800F FOREIGN KEY (createdBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD CONSTRAINT FK_E260A86834269C3F FOREIGN KEY (requestorPerson_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD CONSTRAINT FK_E260A868CFE4D554 FOREIGN KEY (requestorThirdParty_id) REFERENCES chill_3party.third_party (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
|
||||
$this->addSql('CREATE INDEX IDX_E260A8683174800F ON chill_person_accompanying_period (createdBy_id)');
|
||||
$this->addSql('CREATE INDEX IDX_E260A86834269C3F ON chill_person_accompanying_period (requestorPerson_id)');
|
||||
$this->addSql('CREATE INDEX IDX_E260A868CFE4D554 ON chill_person_accompanying_period (requestorThirdParty_id)');
|
||||
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
{
|
||||
|
||||
$this->addSql('DROP TABLE accompanying_periods_scopes');
|
||||
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP CONSTRAINT FK_E260A8683174800F');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP CONSTRAINT FK_E260A86834269C3F');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP CONSTRAINT FK_E260A868CFE4D554');
|
||||
|
||||
|
||||
$this->addSql('DROP INDEX IDX_E260A8683174800F');
|
||||
$this->addSql('DROP INDEX IDX_E260A86834269C3F');
|
||||
$this->addSql('DROP INDEX IDX_E260A868CFE4D554');
|
||||
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP step');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP intensity');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP createdBy_id');
|
||||
@@ -69,6 +39,38 @@ final class Version20210329144338 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP requestorAnonymous');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP emergency');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP confidential');
|
||||
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Complete AccompanyingPeriod table';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE TABLE accompanying_periods_scopes (accompanying_period_id INT NOT NULL, scope_id INT NOT NULL, PRIMARY KEY(accompanying_period_id, scope_id))');
|
||||
|
||||
$this->addSql('CREATE INDEX IDX_87C4EAB032A7A428 ON accompanying_periods_scopes (accompanying_period_id)');
|
||||
$this->addSql('CREATE INDEX IDX_87C4EAB0682B5931 ON accompanying_periods_scopes (scope_id)');
|
||||
|
||||
$this->addSql('ALTER TABLE accompanying_periods_scopes ADD CONSTRAINT FK_87C4EAB032A7A428 FOREIGN KEY (accompanying_period_id) REFERENCES chill_person_accompanying_period (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE accompanying_periods_scopes ADD CONSTRAINT FK_87C4EAB0682B5931 FOREIGN KEY (scope_id) REFERENCES scopes (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD step VARCHAR(32) DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD intensity VARCHAR(255) DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD createdBy_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD requestorPerson_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD requestorThirdParty_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD requestorAnonymous BOOLEAN NOT NULL DEFAULT \'false\'');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD emergency BOOLEAN NOT NULL DEFAULT \'false\'');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD confidential BOOLEAN NOT NULL DEFAULT \'false\'');
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD CONSTRAINT FK_E260A8683174800F FOREIGN KEY (createdBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD CONSTRAINT FK_E260A86834269C3F FOREIGN KEY (requestorPerson_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD CONSTRAINT FK_E260A868CFE4D554 FOREIGN KEY (requestorThirdParty_id) REFERENCES chill_3party.third_party (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
|
||||
$this->addSql('CREATE INDEX IDX_E260A8683174800F ON chill_person_accompanying_period (createdBy_id)');
|
||||
$this->addSql('CREATE INDEX IDX_E260A86834269C3F ON chill_person_accompanying_period (requestorPerson_id)');
|
||||
$this->addSql('CREATE INDEX IDX_E260A868CFE4D554 ON chill_person_accompanying_period (requestorThirdParty_id)');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,28 +15,26 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Rename table closinmotive
|
||||
*
|
||||
* @author Mathieu Jaumotte mathieu.jaumotte@champs-libres.coop
|
||||
* Rename table closinmotive.
|
||||
*/
|
||||
final class Version20210330164922 extends AbstractMigration
|
||||
{
|
||||
public function getDescription() : string
|
||||
{
|
||||
return 'Rename table closinmotive';
|
||||
}
|
||||
|
||||
public function up(Schema $schema) : void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_closingmotive RENAME TO chill_person_accompanying_period_closingmotive');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_closingmotive RENAME CONSTRAINT fk_92351ece727aca70 TO FK_72D110E8727ACA70');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period RENAME CONSTRAINT fk_64a4a621504cb38d TO FK_E260A868504CB38D');
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_closingmotive RENAME TO chill_person_closingmotive');
|
||||
$this->addSql('ALTER TABLE chill_person_closingmotive RENAME CONSTRAINT FK_72D110E8727ACA70 TO fk_92351ece727aca70');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period RENAME CONSTRAINT FK_E260A868504CB38D TO fk_64a4a621504cb38d');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Rename table closinmotive';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_closingmotive RENAME TO chill_person_accompanying_period_closingmotive');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_closingmotive RENAME CONSTRAINT fk_92351ece727aca70 TO FK_72D110E8727ACA70');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period RENAME CONSTRAINT fk_64a4a621504cb38d TO FK_E260A868504CB38D');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,41 +15,11 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Transform join table between Person and AccompanyingPeriod in Doctrine entity
|
||||
* Transform join table between Person and AccompanyingPeriod in Doctrine entity.
|
||||
*/
|
||||
final class Version20210331084527 extends AbstractMigration
|
||||
{
|
||||
public function getDescription() : string
|
||||
{
|
||||
return 'Transform join table between Person and AccompanyingPeriod in Doctrine entity';
|
||||
}
|
||||
|
||||
public function up(Schema $schema) : void
|
||||
{
|
||||
// 1
|
||||
$this->addSql('ALTER TABLE persons_accompanying_periods DROP CONSTRAINT persons_accompanying_periods_pkey');
|
||||
$this->addSql('ALTER TABLE persons_accompanying_periods RENAME TO chill_person_accompanying_period_participation');
|
||||
|
||||
// 2
|
||||
// SERIAL automatically create sequence with NEXTVAL()
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ADD COLUMN id SERIAL NOT NULL PRIMARY KEY');
|
||||
// drop NEXTVAL() in column definition
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ALTER id DROP DEFAULT');
|
||||
|
||||
// 3
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ADD startDate DATE NOT NULL DEFAULT \'1970-01-01\'');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ADD endDate DATE DEFAULT NULL');
|
||||
|
||||
// 4
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation DROP CONSTRAINT fk_49a3871f217bbb47');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation DROP CONSTRAINT fk_49a3871f550b0c53');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ADD CONSTRAINT FK_A59DF89F217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ADD CONSTRAINT FK_A59DF89F550B0C53 FOREIGN KEY (accompanyingperiod_id) REFERENCES chill_person_accompanying_period (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER INDEX idx_49a3871f217bbb47 RENAME TO IDX_A59DF89F217BBB47');
|
||||
$this->addSql('ALTER INDEX idx_49a3871f550b0c53 RENAME TO IDX_A59DF89F550B0C53');
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// 4
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation DROP CONSTRAINT FK_A59DF89F217BBB47');
|
||||
@@ -51,17 +28,47 @@ final class Version20210331084527 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ADD CONSTRAINT fk_49a3871f550b0c53 FOREIGN KEY (accompanyingperiod_id) REFERENCES chill_person_accompanying_period (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER INDEX idx_a59df89f550b0c53 RENAME TO idx_49a3871f550b0c53');
|
||||
$this->addSql('ALTER INDEX idx_a59df89f217bbb47 RENAME TO idx_49a3871f217bbb47');
|
||||
|
||||
|
||||
// 3
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation DROP startDate');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation DROP endDate');
|
||||
|
||||
|
||||
// 2
|
||||
$this->addSql('DROP SEQUENCE chill_person_accompanying_period_participation_id_seq CASCADE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation DROP id');
|
||||
|
||||
|
||||
// 1
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation RENAME TO persons_accompanying_periods');
|
||||
$this->addSql('ALTER TABLE persons_accompanying_periods ADD CONSTRAINT persons_accompanying_periods_pkey PRIMARY KEY (person_id, accompanyingperiod_id)');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Transform join table between Person and AccompanyingPeriod in Doctrine entity';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// 1
|
||||
$this->addSql('ALTER TABLE persons_accompanying_periods DROP CONSTRAINT persons_accompanying_periods_pkey');
|
||||
$this->addSql('ALTER TABLE persons_accompanying_periods RENAME TO chill_person_accompanying_period_participation');
|
||||
|
||||
// 2
|
||||
// SERIAL automatically create sequence with NEXTVAL()
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ADD COLUMN id SERIAL NOT NULL PRIMARY KEY');
|
||||
// drop NEXTVAL() in column definition
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ALTER id DROP DEFAULT');
|
||||
|
||||
// 3
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ADD startDate DATE NOT NULL DEFAULT \'1970-01-01\'');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ADD endDate DATE DEFAULT NULL');
|
||||
|
||||
// 4
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation DROP CONSTRAINT fk_49a3871f217bbb47');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation DROP CONSTRAINT fk_49a3871f550b0c53');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ADD CONSTRAINT FK_A59DF89F217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ADD CONSTRAINT FK_A59DF89F550B0C53 FOREIGN KEY (accompanyingperiod_id) REFERENCES chill_person_accompanying_period (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER INDEX idx_49a3871f217bbb47 RENAME TO IDX_A59DF89F217BBB47');
|
||||
$this->addSql('ALTER INDEX idx_49a3871f550b0c53 RENAME TO IDX_A59DF89F550B0C53');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,25 +15,24 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Rename sequence "closing motive"
|
||||
* Rename sequence "closing motive".
|
||||
*/
|
||||
final class Version20210419105054 extends AbstractMigration
|
||||
{
|
||||
public function getDescription() : string
|
||||
{
|
||||
return 'rename sequence "closing motive"';
|
||||
}
|
||||
|
||||
public function up(Schema $schema) : void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_closingmotive_id_seq RENAME TO '
|
||||
. 'chill_person_accompanying_period_closingmotive_id_seq');
|
||||
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_closingmotive_id_seq '
|
||||
. 'RENAME TO chill_person_closingmotive_id_seq');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'rename sequence "closing motive"';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_closingmotive_id_seq RENAME TO '
|
||||
. 'chill_person_accompanying_period_closingmotive_id_seq');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,24 +15,11 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* set label for origin as json
|
||||
* set label for origin as json.
|
||||
*/
|
||||
final class Version20210419105940 extends AbstractMigration
|
||||
{
|
||||
public function getDescription() : string
|
||||
{
|
||||
return 'set label for origin as json';
|
||||
}
|
||||
|
||||
public function up(Schema $schema) : void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_origin '
|
||||
. 'ALTER label TYPE JSON USING json_build_object(\'fr\', label)::jsonb');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_origin '
|
||||
. 'ALTER label DROP DEFAULT');
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this will keep the '"' at first and last character, but is acceptable
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_origin '
|
||||
@@ -33,4 +27,17 @@ final class Version20210419105940 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_origin '
|
||||
. 'ALTER label DROP DEFAULT');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'set label for origin as json';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_origin '
|
||||
. 'ALTER label TYPE JSON USING json_build_object(\'fr\', label)::jsonb');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_origin '
|
||||
. 'ALTER label DROP DEFAULT');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,21 +15,21 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* fix deprecated json array
|
||||
* fix deprecated json array.
|
||||
*/
|
||||
final class Version20210419112619 extends AbstractMigration
|
||||
{
|
||||
public function getDescription() : string
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'fix deprecated json_array';
|
||||
}
|
||||
|
||||
public function up(Schema $schema) : void
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_closingmotive.name IS NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,16 +15,40 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Create Social action, Social Issue, Work Goal and Work Result
|
||||
* Create Social action, Social Issue, Work Goal and Work Result.
|
||||
*/
|
||||
final class Version20210426145930 extends AbstractMigration
|
||||
{
|
||||
public function getDescription() : string
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_social_action DROP CONSTRAINT FK_B7ABFAB8727ACA70');
|
||||
$this->addSql('ALTER TABLE chill_person_social_action_goal DROP CONSTRAINT FK_163CA4DD3DC32179');
|
||||
$this->addSql('ALTER TABLE chill_person_social_action_result DROP CONSTRAINT FK_CA98C58C3DC32179');
|
||||
$this->addSql('ALTER TABLE chill_person_social_action DROP CONSTRAINT FK_B7ABFAB85E7AA58C');
|
||||
$this->addSql('ALTER TABLE chill_person_social_issue DROP CONSTRAINT FK_7A484DAE727ACA70');
|
||||
$this->addSql('ALTER TABLE chill_person_social_action_goal DROP CONSTRAINT FK_163CA4DD667D1AFE');
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_goal_result DROP CONSTRAINT FK_F3BAEEA9667D1AFE');
|
||||
$this->addSql('ALTER TABLE chill_person_social_action_result DROP CONSTRAINT FK_CA98C58C7A7B643');
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_goal_result DROP CONSTRAINT FK_F3BAEEA97A7B643');
|
||||
$this->addSql('DROP SEQUENCE chill_person_social_action_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE chill_person_social_issue_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE chill_person_social_work_goal_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE chill_person_social_work_result_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_person_social_action');
|
||||
$this->addSql('DROP TABLE chill_person_social_action_goal');
|
||||
$this->addSql('DROP TABLE chill_person_social_action_result');
|
||||
$this->addSql('DROP TABLE chill_person_social_issue');
|
||||
$this->addSql('DROP TABLE chill_person_social_work_goal');
|
||||
$this->addSql('DROP TABLE chill_person_social_work_goal_result');
|
||||
$this->addSql('DROP TABLE chill_person_social_work_result');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Create Social action, Social Issue, Work Goal and Work Result';
|
||||
}
|
||||
|
||||
public function up(Schema $schema) : void
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE SEQUENCE chill_person_social_action_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE chill_person_social_issue_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
@@ -50,28 +81,4 @@ final class Version20210426145930 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_goal_result ADD CONSTRAINT FK_F3BAEEA9667D1AFE FOREIGN KEY (goal_id) REFERENCES chill_person_social_work_goal (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_goal_result ADD CONSTRAINT FK_F3BAEEA97A7B643 FOREIGN KEY (result_id) REFERENCES chill_person_social_work_result (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_social_action DROP CONSTRAINT FK_B7ABFAB8727ACA70');
|
||||
$this->addSql('ALTER TABLE chill_person_social_action_goal DROP CONSTRAINT FK_163CA4DD3DC32179');
|
||||
$this->addSql('ALTER TABLE chill_person_social_action_result DROP CONSTRAINT FK_CA98C58C3DC32179');
|
||||
$this->addSql('ALTER TABLE chill_person_social_action DROP CONSTRAINT FK_B7ABFAB85E7AA58C');
|
||||
$this->addSql('ALTER TABLE chill_person_social_issue DROP CONSTRAINT FK_7A484DAE727ACA70');
|
||||
$this->addSql('ALTER TABLE chill_person_social_action_goal DROP CONSTRAINT FK_163CA4DD667D1AFE');
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_goal_result DROP CONSTRAINT FK_F3BAEEA9667D1AFE');
|
||||
$this->addSql('ALTER TABLE chill_person_social_action_result DROP CONSTRAINT FK_CA98C58C7A7B643');
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_goal_result DROP CONSTRAINT FK_F3BAEEA97A7B643');
|
||||
$this->addSql('DROP SEQUENCE chill_person_social_action_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE chill_person_social_issue_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE chill_person_social_work_goal_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE chill_person_social_work_result_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_person_social_action');
|
||||
$this->addSql('DROP TABLE chill_person_social_action_goal');
|
||||
$this->addSql('DROP TABLE chill_person_social_action_result');
|
||||
$this->addSql('DROP TABLE chill_person_social_issue');
|
||||
$this->addSql('DROP TABLE chill_person_social_work_goal');
|
||||
$this->addSql('DROP TABLE chill_person_social_work_goal_result');
|
||||
$this->addSql('DROP TABLE chill_person_social_work_result');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,16 +15,33 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Create tables for the entites AccomanyingPeriodWork, AccomanyingPeriodWorkGoal & Social/WorkEvaluation
|
||||
* Create tables for the entites AccomanyingPeriodWork, AccomanyingPeriodWorkGoal & Social/WorkEvaluation.
|
||||
*/
|
||||
final class Version20210427125700 extends AbstractMigration
|
||||
{
|
||||
public function getDescription() : string
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_result DROP CONSTRAINT FK_46E95929B99F6060');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_third_party DROP CONSTRAINT FK_83B57B86B99F6060');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_goal DROP CONSTRAINT FK_911B88FEC55C1209');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_goal_result DROP CONSTRAINT FK_3E37D1F37B14AD03');
|
||||
$this->addSql('DROP SEQUENCE chill_person_accompanying_period_work_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE chill_person_accompanying_period_work_goal_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE chill_person_social_work_evaluation_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_work');
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_work_result');
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_work_third_party');
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_work_goal');
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_work_goal_result');
|
||||
$this->addSql('DROP TABLE chill_person_social_work_evaluation');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Create tables for the entites AccomanyingPeriodWork, AccomanyingPeriodWorkGoal & Social/WorkEvaluation';
|
||||
}
|
||||
|
||||
public function up(Schema $schema) : void
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE SEQUENCE chill_person_accompanying_period_work_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE SEQUENCE chill_person_accompanying_period_work_goal_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
@@ -57,21 +81,4 @@ final class Version20210427125700 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_goal_result ADD CONSTRAINT FK_3E37D1F37A7B643 FOREIGN KEY (result_id) REFERENCES chill_person_social_work_result (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_evaluation ADD CONSTRAINT FK_2E23F3FEBF32A3DA FOREIGN KEY (socialAction_id) REFERENCES chill_person_social_action (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_result DROP CONSTRAINT FK_46E95929B99F6060');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_third_party DROP CONSTRAINT FK_83B57B86B99F6060');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_goal DROP CONSTRAINT FK_911B88FEC55C1209');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_goal_result DROP CONSTRAINT FK_3E37D1F37B14AD03');
|
||||
$this->addSql('DROP SEQUENCE chill_person_accompanying_period_work_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE chill_person_accompanying_period_work_goal_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE chill_person_social_work_evaluation_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_work');
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_work_result');
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_work_third_party');
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_work_goal');
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_work_goal_result');
|
||||
$this->addSql('DROP TABLE chill_person_social_work_evaluation');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,20 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Create Household and HouseholdMembers tables
|
||||
* Create Household and HouseholdMembers tables.
|
||||
*/
|
||||
final class Version20210505093408 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE HouseholdMembers DROP CONSTRAINT FK_4D1FB288E79FF843');
|
||||
$this->addSql('ALTER TABLE HouseholdMembers DROP CONSTRAINT FK_4D1FB288217BBB47');
|
||||
$this->addSql('DROP SEQUENCE Household_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE HouseholdMembers_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE Household');
|
||||
$this->addSql('DROP TABLE HouseholdMembers');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Create Household and HouseholdMembers tables';
|
||||
@@ -28,14 +45,4 @@ final class Version20210505093408 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE HouseholdMembers ADD CONSTRAINT FK_4D1FB288217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE HouseholdMembers ADD CONSTRAINT FK_4D1FB288E79FF843 FOREIGN KEY (household_id) REFERENCES Household (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE HouseholdMembers DROP CONSTRAINT FK_4D1FB288E79FF843');
|
||||
$this->addSql('ALTER TABLE HouseholdMembers DROP CONSTRAINT FK_4D1FB288217BBB47');
|
||||
$this->addSql('DROP SEQUENCE Household_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE HouseholdMembers_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE Household');
|
||||
$this->addSql('DROP TABLE HouseholdMembers');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,15 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add a household_to_address table
|
||||
* Add a household_to_address table.
|
||||
*/
|
||||
final class Version20210505154316 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP TABLE chill_person_household_to_addresses');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add a household_to_addresses table';
|
||||
@@ -25,9 +37,4 @@ final class Version20210505154316 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_household_to_addresses ADD CONSTRAINT FK_7109483E79FF843 FOREIGN KEY (household_id) REFERENCES Household (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_household_to_addresses ADD CONSTRAINT FK_7109483F5B7AF75 FOREIGN KEY (address_id) REFERENCES chill_main_address (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP TABLE chill_person_household_to_addresses');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,15 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add a link between social issues and accompanying periods
|
||||
* Add a link between social issues and accompanying periods.
|
||||
*/
|
||||
final class Version20210518075908 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_social_issues');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add a link between social issue and accompanying period';
|
||||
@@ -25,9 +37,4 @@ final class Version20210518075908 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_social_issues ADD CONSTRAINT FK_CAFE078F550B0C53 FOREIGN KEY (accompanyingperiod_id) REFERENCES chill_person_accompanying_period (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_social_issues ADD CONSTRAINT FK_CAFE078FA549916C FOREIGN KEY (socialissue_id) REFERENCES chill_person_social_issue (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_social_issues');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,15 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add a column "initial comment" in accompanying period
|
||||
* Add a column "initial comment" in accompanying period.
|
||||
*/
|
||||
final class Version20210518162439 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP initialComment_id');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add a column "initial comment" in accompanying period';
|
||||
@@ -23,9 +35,4 @@ final class Version20210518162439 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD CONSTRAINT FK_E260A8683111D50B FOREIGN KEY (initialComment_id) REFERENCES chill_person_accompanying_period_comment (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX IDX_E260A8683111D50B ON chill_person_accompanying_period (initialComment_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP initialComment_id');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,17 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add updatedAt, updatedBy, createdAt on accompanying period
|
||||
* Add updatedAt, updatedBy, createdAt on accompanying period.
|
||||
*/
|
||||
final class Version20210519204938 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP createdAt');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP updatedAt');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP updatedBy_id');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add updatedAt, updatedBy, createdAt on accompanying period';
|
||||
@@ -25,11 +39,4 @@ final class Version20210519204938 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period ADD CONSTRAINT FK_E260A86865FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX IDX_E260A86865FF1AEC ON chill_person_accompanying_period (updatedBy_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP createdAt');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP updatedAt');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP updatedBy_id');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,16 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Specify ON DELETE behaviour to handle deletion of parents in associated tables
|
||||
* Specify ON DELETE behaviour to handle deletion of parents in associated tables.
|
||||
*/
|
||||
final class Version20210525211214 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_comment DROP CONSTRAINT fk_cd960ef3d7fa8ef0');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_comment ADD CONSTRAINT fk_cd960ef3d7fa8ef0 FOREIGN KEY (accompanyingperiod_id) REFERENCES chill_person_accompanying_period (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Specify ON DELETE behaviour to handle deletion of parents in associated tables';
|
||||
@@ -22,10 +35,4 @@ final class Version20210525211214 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_comment DROP CONSTRAINT FK_CD960EF3D7FA8EF0');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_comment ADD CONSTRAINT FK_CD960EF3D7FA8EF0 FOREIGN KEY (accompanyingPeriod_id) REFERENCES chill_person_accompanying_period (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_comment DROP CONSTRAINT fk_cd960ef3d7fa8ef0');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_comment ADD CONSTRAINT fk_cd960ef3d7fa8ef0 FOREIGN KEY (accompanyingperiod_id) REFERENCES chill_person_accompanying_period (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,15 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* prefix table concerning household with 'chill_person' and add constraints
|
||||
* prefix table concerning household with 'chill_person' and add constraints.
|
||||
*/
|
||||
final class Version20210528092625 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->throwIrreversibleMigrationException('the down method is not implemented');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'prefix table concerning household with \'chill_person\' and add constraints';
|
||||
@@ -37,13 +49,13 @@ final class Version20210528092625 extends AbstractMigration
|
||||
|
||||
// create constraint 'householdmembers not overlaps'
|
||||
$this->addSql('ALTER TABLE chill_person_household_members ADD CHECK (startdate < enddate)');
|
||||
$this->addSql('ALTER TABLE chill_person_household_members ADD CONSTRAINT '.
|
||||
"household_members_not_overlaps EXCLUDE USING GIST(
|
||||
$this->addSql('ALTER TABLE chill_person_household_members ADD CONSTRAINT ' .
|
||||
'household_members_not_overlaps EXCLUDE USING GIST(
|
||||
-- extension btree_gist required to include comparaison with integer
|
||||
person_id WITH =,
|
||||
daterange(startdate, enddate) WITH &&
|
||||
) WHERE (sharedhousehold IS TRUE)
|
||||
INITIALLY DEFERRED");
|
||||
INITIALLY DEFERRED');
|
||||
|
||||
// rename constraints
|
||||
$this->addSql('ALTER TABLE public.chill_person_household_to_addresses DROP CONSTRAINT fk_7109483e79ff843');
|
||||
@@ -55,9 +67,4 @@ final class Version20210528092625 extends AbstractMigration
|
||||
$this->addSql('ALTER INDEX idx_4d1fb288e79ff843 RENAME TO IDX_EEF5DED7E79FF843');
|
||||
$this->addSql('ALTER INDEX idx_4d1fb288217bbb47 RENAME TO IDX_EEF5DED7217BBB47');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->throwIrreversibleMigrationException("the down method is not implemented");
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,19 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add position to househould_member
|
||||
* Add position to househould_member.
|
||||
*/
|
||||
final class Version20210528111624 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_household_members DROP CONSTRAINT FK_EEF5DED7DD842E46');
|
||||
$this->addSql('DROP SEQUENCE chill_person_household_position_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_person_household_position');
|
||||
$this->addSql('ALTER TABLE chill_person_household_members ADD "position" VARCHAR(255) DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_household_members DROP position_id');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add position to househould_member';
|
||||
@@ -21,19 +37,10 @@ final class Version20210528111624 extends AbstractMigration
|
||||
{
|
||||
$this->addSql('CREATE SEQUENCE chill_person_household_position_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE TABLE chill_person_household_position (id INT NOT NULL, label JSON NOT NULL, shareHouseHold BOOLEAN NOT NULL, allowHolder BOOLEAN NOT NULL, ordering DOUBLE PRECISION NOT NULL, PRIMARY KEY(id))');
|
||||
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_household_members ADD position_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_household_members DROP "position"');
|
||||
$this->addSql('ALTER TABLE chill_person_household_members ADD CONSTRAINT FK_EEF5DED7DD842E46 FOREIGN KEY (position_id) REFERENCES chill_person_household_position (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX IDX_EEF5DED7DD842E46 ON chill_person_household_members (position_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_household_members DROP CONSTRAINT FK_EEF5DED7DD842E46');
|
||||
$this->addSql('DROP SEQUENCE chill_person_household_position_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_person_household_position');
|
||||
$this->addSql('ALTER TABLE chill_person_household_members ADD "position" VARCHAR(255) DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_household_members DROP position_id');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,16 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Household members: allow startdate and enddate to be null
|
||||
* Household members: allow startdate and enddate to be null.
|
||||
*/
|
||||
final class Version20210528132405 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_household_members ALTER startDate SET NOT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_household_members ALTER endDate SET NOT NULL');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Household members: allow startdate and enddate to be null';
|
||||
@@ -22,10 +35,4 @@ final class Version20210528132405 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_household_members ALTER startdate DROP NOT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_household_members ALTER enddate DROP NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_household_members ALTER startDate SET NOT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_household_members ALTER endDate SET NOT NULL');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,15 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add house holder on membership
|
||||
* Add house holder on membership.
|
||||
*/
|
||||
final class Version20210528142121 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_household_members DROP COLUMN holder');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add house holder on membership';
|
||||
@@ -21,9 +33,4 @@ final class Version20210528142121 extends AbstractMigration
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_household_members ADD holder BOOLEAN DEFAULT FALSE NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_household_members DROP COLUMN holder');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,17 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add comments and expecting birth to household
|
||||
* Add comments and expecting birth to household.
|
||||
*/
|
||||
final class Version20210614191600 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_household DROP comment_members');
|
||||
$this->addSql('ALTER TABLE chill_person_household DROP waiting_for_birth');
|
||||
$this->addSql('ALTER TABLE chill_person_household DROP waiting_for_birth_date');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add comments and expecting birth to household';
|
||||
@@ -24,11 +38,4 @@ final class Version20210614191600 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_household ADD waiting_for_birth_date DATE DEFAULT NULL');
|
||||
$this->addSql('COMMENT ON COLUMN chill_person_household.waiting_for_birth_date IS \'(DC2Type:date_immutable)\'');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_household DROP comment_members');
|
||||
$this->addSql('ALTER TABLE chill_person_household DROP waiting_for_birth');
|
||||
$this->addSql('ALTER TABLE chill_person_household DROP waiting_for_birth_date');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,20 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Set comment in household as Embedded Comment
|
||||
* Set comment in household as Embedded Comment.
|
||||
*/
|
||||
final class Version20210615074857 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_household RENAME comment_members_comment TO comment_members');
|
||||
$this->addSql('ALTER TABLE chill_person_household ALTER comment_members SET DEFAULT \'\'');
|
||||
$this->addSql('ALTER TABLE chill_person_household ALTER comment_members SET NOT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_household DROP comment_members_comment');
|
||||
$this->addSql('ALTER TABLE chill_person_household DROP comment_members_userId');
|
||||
$this->addSql('ALTER TABLE chill_person_household DROP comment_members_date');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'replace comment in household as embedded comment';
|
||||
@@ -26,14 +43,4 @@ final class Version20210615074857 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_household ADD comment_members_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_household ADD CONSTRAINT fk_household_comment_embeddable_user FOREIGN KEY (comment_members_userId) REFERENCES users (id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_household RENAME comment_members_comment TO comment_members');
|
||||
$this->addSql('ALTER TABLE chill_person_household ALTER comment_members SET DEFAULT \'\'');
|
||||
$this->addSql('ALTER TABLE chill_person_household ALTER comment_members SET NOT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_household DROP comment_members_comment');
|
||||
$this->addSql('ALTER TABLE chill_person_household DROP comment_members_userId');
|
||||
$this->addSql('ALTER TABLE chill_person_household DROP comment_members_date');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,15 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Create a view for assembling household, person and addresses
|
||||
* Create a view for assembling household, person and addresses.
|
||||
*/
|
||||
final class Version20210616102900 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP VIEW view_chill_person_household_address');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Create a view for assembling household, person and addresses';
|
||||
@@ -19,25 +31,20 @@ final class Version20210616102900 extends AbstractMigration
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql("CREATE VIEW view_chill_person_household_address AS ".
|
||||
"SELECT ".
|
||||
"members.person_id AS person_id, ".
|
||||
"members.household_id AS household_id, ".
|
||||
"members.id AS member_id, ".
|
||||
"address.id AS address_id, ".
|
||||
"CASE WHEN address.validFrom < members.startDate THEN members.startDate ELSE address.validFrom END AS validFrom, ".
|
||||
"CASE WHEN COALESCE(address.validTo, 'infinity') < COALESCE(members.endDate, 'infinity') THEN address.validTo ELSE members.endDate END AS validTo ".
|
||||
"FROM chill_person_household_members AS members ".
|
||||
"JOIN chill_person_household_to_addresses AS household_to_addr ON household_to_addr.household_id = members.household_id ".
|
||||
"JOIN chill_main_address AS address ON household_to_addr.address_id = address.id ".
|
||||
"AND daterange(address.validFrom, address.validTo) && daterange(members.startDate, members.endDate) ".
|
||||
"WHERE members.sharedhousehold IS TRUE "
|
||||
$this->addSql(
|
||||
'CREATE VIEW view_chill_person_household_address AS ' .
|
||||
'SELECT ' .
|
||||
'members.person_id AS person_id, ' .
|
||||
'members.household_id AS household_id, ' .
|
||||
'members.id AS member_id, ' .
|
||||
'address.id AS address_id, ' .
|
||||
'CASE WHEN address.validFrom < members.startDate THEN members.startDate ELSE address.validFrom END AS validFrom, ' .
|
||||
"CASE WHEN COALESCE(address.validTo, 'infinity') < COALESCE(members.endDate, 'infinity') THEN address.validTo ELSE members.endDate END AS validTo " .
|
||||
'FROM chill_person_household_members AS members ' .
|
||||
'JOIN chill_person_household_to_addresses AS household_to_addr ON household_to_addr.household_id = members.household_id ' .
|
||||
'JOIN chill_main_address AS address ON household_to_addr.address_id = address.id ' .
|
||||
'AND daterange(address.validFrom, address.validTo) && daterange(members.startDate, members.endDate) ' .
|
||||
'WHERE members.sharedhousehold IS TRUE '
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql("DROP VIEW view_chill_person_household_address");
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,25 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add new fields to Person entity
|
||||
* Add new fields to Person entity.
|
||||
*/
|
||||
final class Version20210617073504 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP deathdate');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP maritalStatusDate');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP acceptSMS');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP acceptEmail');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP numberOfChildren');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP genderComment_comment');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP genderComment_userId');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP genderComment_date');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP maritalStatusComment_comment');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP maritalStatusComment_userId');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP maritalStatusComment_date');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add new fields to Person entity';
|
||||
@@ -31,19 +53,4 @@ final class Version20210617073504 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD maritalStatusComment_userId INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD maritalStatusComment_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP deathdate');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP maritalStatusDate');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP acceptSMS');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP acceptEmail');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP numberOfChildren');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP genderComment_comment');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP genderComment_userId');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP genderComment_date');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP maritalStatusComment_comment');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP maritalStatusComment_userId');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP maritalStatusComment_date');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,23 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add createdAt, createdBy, updatedAt, updatedBy fields on Person
|
||||
* Add createdAt, createdBy, updatedAt, updatedBy fields on Person.
|
||||
*/
|
||||
final class Version20210618080702 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP CONSTRAINT FK_BF210A143174800F');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP CONSTRAINT FK_BF210A1465FF1AEC');
|
||||
$this->addSql('DROP INDEX IDX_BF210A143174800F');
|
||||
$this->addSql('DROP INDEX IDX_BF210A1465FF1AEC');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP createdAt');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP updatedAt');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP createdBy_id');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP updatedBy_id');
|
||||
$this->addSql('COMMENT ON COLUMN chill_person_person.deathdate IS NULL');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add createdAt, createdBy, updatedAt, updatedBy fields on Person';
|
||||
@@ -29,17 +49,4 @@ final class Version20210618080702 extends AbstractMigration
|
||||
$this->addSql('CREATE INDEX IDX_BF210A143174800F ON chill_person_person (createdBy_id)');
|
||||
$this->addSql('CREATE INDEX IDX_BF210A1465FF1AEC ON chill_person_person (updatedBy_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP CONSTRAINT FK_BF210A143174800F');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP CONSTRAINT FK_BF210A1465FF1AEC');
|
||||
$this->addSql('DROP INDEX IDX_BF210A143174800F');
|
||||
$this->addSql('DROP INDEX IDX_BF210A1465FF1AEC');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP createdAt');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP updatedAt');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP createdBy_id');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP updatedBy_id');
|
||||
$this->addSql('COMMENT ON COLUMN chill_person_person.deathdate IS NULL');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,25 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* add updated information to accompanying period work
|
||||
* add updated information to accompanying period work.
|
||||
*/
|
||||
final class Version20210620143757 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work DROP updatedAt');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work DROP updatedBy_id');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER createdAt TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER createdAt DROP DEFAULT');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER startDate TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER startDate DROP DEFAULT');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER endDate TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER endDate DROP DEFAULT');
|
||||
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_work.createdat IS NULL');
|
||||
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_work.startdate IS NULL');
|
||||
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_work.enddate IS NULL');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'add updated information to accompanying period work';
|
||||
@@ -33,19 +55,4 @@ final class Version20210620143757 extends AbstractMigration
|
||||
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_work.startDate IS \'(DC2Type:datetime_immutable)\'');
|
||||
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_work.endDate IS \'(DC2Type:datetime_immutable)\'');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work DROP updatedAt');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work DROP updatedBy_id');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER createdAt TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER createdAt DROP DEFAULT');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER startDate TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER startDate DROP DEFAULT');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER endDate TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ALTER endDate DROP DEFAULT');
|
||||
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_work.createdat IS NULL');
|
||||
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_work.startdate IS NULL');
|
||||
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_work.enddate IS NULL');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,15 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add link to accompanying period work and persons
|
||||
* Add link to accompanying period work and persons.
|
||||
*/
|
||||
final class Version20210623135043 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_work_person');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add link to accompanying period work and persons';
|
||||
@@ -19,16 +31,10 @@ final class Version20210623135043 extends AbstractMigration
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql("CREATE TABLE chill_person_accompanying_period_work_person (accompanyingperiodwork_id INT NOT NULL, person_id INT NOT NULL, PRIMARY KEY(accompanyingperiodwork_id, person_id))");
|
||||
$this->addSql("CREATE INDEX IDX_615F494CB99F6060 ON chill_person_accompanying_period_work_person (accompanyingperiodwork_id)");
|
||||
$this->addSql("CREATE INDEX IDX_615F494C217BBB47 ON chill_person_accompanying_period_work_person (person_id)");
|
||||
$this->addSql("ALTER TABLE chill_person_accompanying_period_work_person ADD CONSTRAINT FK_615F494CB99F6060 FOREIGN KEY (accompanyingperiodwork_id) REFERENCES chill_person_accompanying_period_work (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE");
|
||||
$this->addSql("ALTER TABLE chill_person_accompanying_period_work_person ADD CONSTRAINT FK_615F494C217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE");
|
||||
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql("DROP TABLE chill_person_accompanying_period_work_person");
|
||||
$this->addSql('CREATE TABLE chill_person_accompanying_period_work_person (accompanyingperiodwork_id INT NOT NULL, person_id INT NOT NULL, PRIMARY KEY(accompanyingperiodwork_id, person_id))');
|
||||
$this->addSql('CREATE INDEX IDX_615F494CB99F6060 ON chill_person_accompanying_period_work_person (accompanyingperiodwork_id)');
|
||||
$this->addSql('CREATE INDEX IDX_615F494C217BBB47 ON chill_person_accompanying_period_work_person (person_id)');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_person ADD CONSTRAINT FK_615F494CB99F6060 FOREIGN KEY (accompanyingperiodwork_id) REFERENCES chill_person_accompanying_period_work (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_person ADD CONSTRAINT FK_615F494C217BBB47 FOREIGN KEY (person_id) REFERENCES chill_person_person (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -12,6 +19,11 @@ use Doctrine\Migrations\AbstractMigration;
|
||||
*/
|
||||
final class Version20210623142046 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_social_action ALTER defaultNotificationDelay SET NOT NULL');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
@@ -21,9 +33,4 @@ final class Version20210623142046 extends AbstractMigration
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_social_action ALTER defaultnotificationdelay DROP NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_social_action ALTER defaultNotificationDelay SET NOT NULL');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -12,6 +19,11 @@ use Doctrine\Migrations\AbstractMigration;
|
||||
*/
|
||||
final class Version20210624131722 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_evaluation ALTER delay SET NOT NULL');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
@@ -21,9 +33,4 @@ final class Version20210624131722 extends AbstractMigration
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_evaluation ALTER delay DROP NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_evaluation ALTER delay SET NOT NULL');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -12,6 +19,11 @@ use Doctrine\Migrations\AbstractMigration;
|
||||
*/
|
||||
final class Version20210624131723 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_evaluation ALTER notificationdelay SET NOT NULL');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
@@ -21,9 +33,4 @@ final class Version20210624131723 extends AbstractMigration
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_evaluation ALTER notificationdelay DROP NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_evaluation ALTER notificationdelay SET NOT NULL');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,20 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add location to accompanying period
|
||||
* Add location to accompanying period.
|
||||
*/
|
||||
final class Version20210727152826 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP CONSTRAINT FK_E260A868D5213D34');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP CONSTRAINT FK_E260A8689B07D6BF');
|
||||
$this->addSql('DROP INDEX IDX_E260A868D5213D34');
|
||||
$this->addSql('DROP INDEX IDX_E260A8689B07D6BF');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP personLocation_id');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP addressLocation_id');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add location to accompanying period';
|
||||
@@ -26,14 +43,4 @@ final class Version20210727152826 extends AbstractMigration
|
||||
$this->addSql('CREATE INDEX IDX_E260A868D5213D34 ON chill_person_accompanying_period (personLocation_id)');
|
||||
$this->addSql('CREATE INDEX IDX_E260A8689B07D6BF ON chill_person_accompanying_period (addressLocation_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP CONSTRAINT FK_E260A868D5213D34');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP CONSTRAINT FK_E260A8689B07D6BF');
|
||||
$this->addSql('DROP INDEX IDX_E260A868D5213D34');
|
||||
$this->addSql('DROP INDEX IDX_E260A8689B07D6BF');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP personLocation_id');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period DROP addressLocation_id');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,16 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Create class AccompanyingPeriodWorkEvaluation
|
||||
* Create class AccompanyingPeriodWorkEvaluation.
|
||||
*/
|
||||
final class Version20210729163023 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP SEQUENCE chill_person_accompanying_period_work_evaluation_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_work_evaluation');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'create class and tables for AccompanyingPeriodWorkEvaluation';
|
||||
@@ -36,10 +49,4 @@ final class Version20210729163023 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_evaluation ADD CONSTRAINT FK_741A3A0B3174800F FOREIGN KEY (createdBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_evaluation ADD CONSTRAINT FK_741A3A0B65FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP SEQUENCE chill_person_accompanying_period_work_evaluation_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_work_evaluation');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,20 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add document to AccompanyingPeriodWorkEvaluation
|
||||
* Add document to AccompanyingPeriodWorkEvaluation.
|
||||
*/
|
||||
final class Version20210730094514 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('COMMENT ON COLUMN chill_calendar.calendar_range.startdate IS \'(DC2Type:datetimetz_immutable)\'');
|
||||
$this->addSql('COMMENT ON COLUMN chill_calendar.calendar_range.enddate IS \'(DC2Type:datetimetz_immutable)\'');
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_work_evaluation_document');
|
||||
$this->addSql('DROP SEQUENCE chill_person_accompanying_period_work_eval_doc_id_seq');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work DROP CONSTRAINT FK_B694FB365FF1AEC');
|
||||
$this->addSql('DROP INDEX IDX_B694FB365FF1AEC');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'add documents to AccompanyingPeriodWorkEvaluation';
|
||||
@@ -34,14 +51,4 @@ final class Version20210730094514 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work ADD CONSTRAINT FK_B694FB365FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX IDX_B694FB365FF1AEC ON chill_person_accompanying_period_work (updatedBy_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('COMMENT ON COLUMN chill_calendar.calendar_range.startdate IS \'(DC2Type:datetimetz_immutable)\'');
|
||||
$this->addSql('COMMENT ON COLUMN chill_calendar.calendar_range.enddate IS \'(DC2Type:datetimetz_immutable)\'');
|
||||
$this->addSql('DROP TABLE chill_person_accompanying_period_work_evaluation_document');
|
||||
$this->addSql('DROP SEQUENCE chill_person_accompanying_period_work_eval_doc_id_seq');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work DROP CONSTRAINT FK_B694FB365FF1AEC');
|
||||
$this->addSql('DROP INDEX IDX_B694FB365FF1AEC');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,16 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* add nullable fields to social work evaluation
|
||||
* add nullable fields to social work evaluation.
|
||||
*/
|
||||
final class Version20210730205407 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_evaluation ALTER delay SET NOT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_evaluation ALTER notificationDelay SET NOT NULL');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'add nullable fields to social work evaluation';
|
||||
@@ -22,10 +35,4 @@ final class Version20210730205407 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_evaluation ALTER delay DROP NOT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_evaluation ALTER notificationdelay DROP NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_evaluation ALTER delay SET NOT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_social_work_evaluation ALTER notificationDelay SET NOT NULL');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,15 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add comment to accompanying period work evaluation d
|
||||
* Add comment to accompanying period work evaluation d.
|
||||
*/
|
||||
final class Version20210802202838 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_evaluation DROP comment');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add comment to accompanying period work evaluation';
|
||||
@@ -21,9 +33,4 @@ final class Version20210802202838 extends AbstractMigration
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_evaluation ADD comment TEXT DEFAULT \'\' NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_evaluation DROP comment');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,20 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add a link between evaluation document, stored object, and document template
|
||||
* Add a link between evaluation document, stored object, and document template.
|
||||
*/
|
||||
final class Version20210820093927 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_evaluation_document DROP CONSTRAINT FK_33EC92296C99C13A');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_evaluation_document DROP CONSTRAINT FK_33EC92295DA0FB8');
|
||||
$this->addSql('DROP INDEX IDX_33EC92296C99C13A');
|
||||
$this->addSql('DROP INDEX IDX_33EC92295DA0FB8');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_evaluation_document DROP template_id');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_evaluation_document DROP storedObject_id');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add a link between evaluation document, stored object, and document template';
|
||||
@@ -26,14 +43,4 @@ final class Version20210820093927 extends AbstractMigration
|
||||
$this->addSql('CREATE INDEX IDX_33EC92296C99C13A ON chill_person_accompanying_period_work_evaluation_document (storedObject_id)');
|
||||
$this->addSql('CREATE INDEX IDX_33EC92295DA0FB8 ON chill_person_accompanying_period_work_evaluation_document (template_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_evaluation_document DROP CONSTRAINT FK_33EC92296C99C13A');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_evaluation_document DROP CONSTRAINT FK_33EC92295DA0FB8');
|
||||
$this->addSql('DROP INDEX IDX_33EC92296C99C13A');
|
||||
$this->addSql('DROP INDEX IDX_33EC92295DA0FB8');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_evaluation_document DROP template_id');
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_work_evaluation_document DROP storedObject_id');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,15 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add missing sequence for evaluation documents
|
||||
* Add missing sequence for evaluation documents.
|
||||
*/
|
||||
final class Version20210820100407 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP SEQUENCE chill_person_social_work_eval_doc_id_seq');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add missing sequence for evaluation documents';
|
||||
@@ -21,9 +33,4 @@ final class Version20210820100407 extends AbstractMigration
|
||||
{
|
||||
$this->addSql('CREATE SEQUENCE chill_person_social_work_eval_doc_id_seq INCREMENT BY 1 MINVALUE 1000 START 1000');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP SEQUENCE chill_person_social_work_eval_doc_id_seq');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,15 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Allow to create persons without center
|
||||
* Allow to create persons without center.
|
||||
*/
|
||||
final class Version20210831140339 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER center_id SET NOT NULL');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Allow to create persons without center';
|
||||
@@ -21,9 +33,4 @@ final class Version20210831140339 extends AbstractMigration
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER center_id DROP NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER center_id SET NOT NULL');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,16 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Optimize trigram index on person fullname: create index for both center_id and fullname
|
||||
* Optimize trigram index on person fullname: create index for both center_id and fullname.
|
||||
*/
|
||||
final class Version20210910161858 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP INDEX fullnamecanonical_trgm_idx');
|
||||
$this->addSql('CREATE INDEX fullnameCanonical_trgm_idx ON chill_person_person USING GIST (fullnameCanonical gist_trgm_ops)');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Optimize trigram index on person fullname: create index for both center_id and fullname';
|
||||
@@ -22,10 +35,4 @@ final class Version20210910161858 extends AbstractMigration
|
||||
$this->addSql('DROP INDEX fullnamecanonical_trgm_idx');
|
||||
$this->addSql('CREATE INDEX fullnameCanonical_trgm_idx ON chill_person_person USING GIST (center_id, fullnameCanonical gist_trgm_ops)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP INDEX fullnamecanonical_trgm_idx');
|
||||
$this->addSql('CREATE INDEX fullnameCanonical_trgm_idx ON chill_person_person USING GIST (fullnameCanonical gist_trgm_ops)');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,17 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Create view for PersonCurrentAddress and related indexes
|
||||
* Create view for PersonCurrentAddress and related indexes.
|
||||
*/
|
||||
final class Version20210915093624 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP VIEW view_chill_person_current_address');
|
||||
$this->addSql('DROP INDEX chill_custom_main_address_filtering_idx');
|
||||
$this->addSql('DROP INDEX chill_custom_person_household_members_sharing_idx');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Create view for PersonCurrentAddress and related indexes';
|
||||
@@ -36,14 +50,7 @@ final class Version20210915093624 extends AbstractMigration
|
||||
current_date between cma.validfrom AND coalesce(validto, 'infinity'::date)
|
||||
");
|
||||
|
||||
$this->addSql("CREATE INDEX chill_custom_main_address_filtering_idx ON chill_main_address USING btree (id, validfrom ASC, validto DESC)");
|
||||
$this->addSql("CREATE INDEX chill_custom_person_household_members_sharing_idx ON chill_person_household_members USING btree (person_id, startdate ASC, enddate DESC, household_id) WHERE sharedhousehold IS TRUE");
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql("DROP VIEW view_chill_person_current_address");
|
||||
$this->addSql("DROP INDEX chill_custom_main_address_filtering_idx");
|
||||
$this->addSql("DROP INDEX chill_custom_person_household_members_sharing_idx");
|
||||
$this->addSql('CREATE INDEX chill_custom_main_address_filtering_idx ON chill_main_address USING btree (id, validfrom ASC, validto DESC)');
|
||||
$this->addSql('CREATE INDEX chill_custom_person_household_members_sharing_idx ON chill_person_household_members USING btree (person_id, startdate ASC, enddate DESC, household_id) WHERE sharedhousehold IS TRUE');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -12,6 +19,12 @@ use Doctrine\Migrations\AbstractMigration;
|
||||
*/
|
||||
final class Version20211020131133 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP INDEX person_unique');
|
||||
$this->addSql('DROP INDEX thirdparty_unique');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Validation added to accompanying period resources and accompanying period.';
|
||||
@@ -22,10 +35,4 @@ final class Version20211020131133 extends AbstractMigration
|
||||
$this->addSql('CREATE UNIQUE INDEX person_unique ON chill_person_accompanying_period_resource (person_id, accompanyingperiod_id) WHERE person_id IS NOT NULL');
|
||||
$this->addSql('CREATE UNIQUE INDEX thirdparty_unique ON chill_person_accompanying_period_resource (thirdparty_id, accompanyingperiod_id) WHERE thirdparty_id IS NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP INDEX person_unique');
|
||||
$this->addSql('DROP INDEX thirdparty_unique');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -12,6 +19,11 @@ use Doctrine\Migrations\AbstractMigration;
|
||||
*/
|
||||
final class Version20211021125359 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE UNIQUE INDEX participation_unique ON chill_person_accompanying_period_participation (accompanyingperiod_id, person_id)');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Custom constraint added to database to prevent identical participations.';
|
||||
@@ -20,17 +32,12 @@ final class Version20211021125359 extends AbstractMigration
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// creates a constraint 'participations may not overlap'
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ADD CONSTRAINT '.
|
||||
"participations_no_overlap EXCLUDE USING GIST(
|
||||
$this->addSql('ALTER TABLE chill_person_accompanying_period_participation ADD CONSTRAINT ' .
|
||||
'participations_no_overlap EXCLUDE USING GIST(
|
||||
-- extension btree_gist required to include comparaison with integer
|
||||
person_id WITH =, accompanyingperiod_id WITH =,
|
||||
daterange(startdate, enddate) WITH &&
|
||||
)
|
||||
INITIALLY DEFERRED");
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE UNIQUE INDEX participation_unique ON chill_person_accompanying_period_participation (accompanyingperiod_id, person_id)');
|
||||
INITIALLY DEFERRED');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,19 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Create the relationship and relation entity
|
||||
* Create the relationship and relation entity.
|
||||
*/
|
||||
final class Version20211025141226 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_relationships DROP CONSTRAINT FK_23D47C513256915B');
|
||||
$this->addSql('DROP SEQUENCE chill_person_relations_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE chill_person_relationships_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_person_relations');
|
||||
$this->addSql('DROP TABLE chill_person_relationships');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Create the relationship and relation entity';
|
||||
@@ -36,14 +52,4 @@ final class Version20211025141226 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_relationships ADD CONSTRAINT FK_23D47C513174800F FOREIGN KEY (createdBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_person_relationships ADD CONSTRAINT FK_23D47C5165FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
|
||||
$this->addSql('ALTER TABLE chill_person_relationships DROP CONSTRAINT FK_23D47C513256915B');
|
||||
$this->addSql('DROP SEQUENCE chill_person_relations_id_seq CASCADE');
|
||||
$this->addSql('DROP SEQUENCE chill_person_relationships_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_person_relations');
|
||||
$this->addSql('DROP TABLE chill_person_relationships');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -12,6 +19,11 @@ use Doctrine\Migrations\AbstractMigration;
|
||||
*/
|
||||
final class Version20211029075117 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_relations DROP isActive');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'isActive property added to Relation entity.';
|
||||
@@ -21,9 +33,4 @@ final class Version20211029075117 extends AbstractMigration
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_relations ADD isActive BOOLEAN DEFAULT true NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_relations DROP isActive');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,17 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add Civility to Person
|
||||
* Add Civility to Person.
|
||||
*/
|
||||
final class Version20211108100849 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP CONSTRAINT FK_BF210A1423D6A298');
|
||||
$this->addSql('DROP INDEX IDX_BF210A1423D6A298');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP civility_id');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add Civility to Person';
|
||||
@@ -23,11 +37,4 @@ final class Version20211108100849 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD CONSTRAINT FK_BF210A1423D6A298 FOREIGN KEY (civility_id) REFERENCES chill_main_civility (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX IDX_BF210A1423D6A298 ON chill_person_person (civility_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP CONSTRAINT FK_BF210A1423D6A298');
|
||||
$this->addSql('DROP INDEX IDX_BF210A1423D6A298');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP civility_id');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -8,10 +15,18 @@ use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* drop not null in person phonenumber
|
||||
* drop not null in person phonenumber.
|
||||
*/
|
||||
final class Version20211112170027 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER mobilenumber DROP NOT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER phonenumber DROP NOT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER mobilenumber SET DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER phonenumber SET DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Drop not null in person table: set default empty value';
|
||||
@@ -26,12 +41,4 @@ final class Version20211112170027 extends AbstractMigration
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER mobilenumber SET DEFAULT \'\'');
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER phonenumber SET DEFAULT \'\'');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER mobilenumber DROP NOT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER phonenumber DROP NOT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER mobilenumber SET DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ALTER phonenumber SET DEFAULT NULL');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -9,6 +16,12 @@ use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20211119211101 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP INDEX person_birthdate');
|
||||
$this->addSql('DROP INDEX phonenumber');
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'add indexes for searching by birthdate';
|
||||
@@ -19,10 +32,4 @@ final class Version20211119211101 extends AbstractMigration
|
||||
$this->addSql('CREATE INDEX person_birthdate ON chill_person_person (birthdate)');
|
||||
$this->addSql('CREATE INDEX phonenumber ON chill_person_phone USING GIST (phonenumber gist_trgm_ops)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP INDEX person_birthdate');
|
||||
$this->addSql('DROP INDEX phonenumber');
|
||||
}
|
||||
}
|
||||
|
@@ -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\Person;
|
||||
@@ -9,6 +16,26 @@ use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20211119215630 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql("CREATE OR REPLACE VIEW view_chill_person_current_address AS
|
||||
SELECT
|
||||
cphm.person_id AS person_id,
|
||||
cma.id AS address_id,
|
||||
CASE WHEN cphm.startdate > COALESCE(cma.validfrom, '-infinity'::date) THEN cphm.startdate ELSE cma.validfrom END AS valid_from,
|
||||
CASE WHEN COALESCE(cphm.enddate, 'infinity'::date) < COALESCE(cma.validto, 'infinity'::date) THEN cphm.enddate ELSE cma.validto END AS valid_to
|
||||
FROM chill_person_household_members AS cphm
|
||||
LEFT JOIN chill_person_household_to_addresses AS cphta ON cphta.household_id = cphm.household_id
|
||||
LEFT JOIN chill_main_address AS cma ON cphta.address_id = cma.id
|
||||
WHERE
|
||||
cphm.sharedhousehold IS TRUE
|
||||
AND
|
||||
current_date between cphm.startdate AND coalesce(enddate, 'infinity'::date)
|
||||
AND
|
||||
current_date between cma.validfrom AND coalesce(validto, 'infinity'::date)
|
||||
");
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'update computation of view_chill_person_current_address: do not take enddate into account';
|
||||
@@ -33,26 +60,4 @@ final class Version20211119215630 extends AbstractMigration
|
||||
daterange(cma.validfrom, cma.validto, '[)') @> current_date
|
||||
");
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql("CREATE OR REPLACE VIEW view_chill_person_current_address AS
|
||||
SELECT
|
||||
cphm.person_id AS person_id,
|
||||
cma.id AS address_id,
|
||||
CASE WHEN cphm.startdate > COALESCE(cma.validfrom, '-infinity'::date) THEN cphm.startdate ELSE cma.validfrom END AS valid_from,
|
||||
CASE WHEN COALESCE(cphm.enddate, 'infinity'::date) < COALESCE(cma.validto, 'infinity'::date) THEN cphm.enddate ELSE cma.validto END AS valid_to
|
||||
FROM chill_person_household_members AS cphm
|
||||
LEFT JOIN chill_person_household_to_addresses AS cphta ON cphta.household_id = cphm.household_id
|
||||
LEFT JOIN chill_main_address AS cma ON cphta.address_id = cma.id
|
||||
WHERE
|
||||
cphm.sharedhousehold IS TRUE
|
||||
AND
|
||||
current_date between cphm.startdate AND coalesce(enddate, 'infinity'::date)
|
||||
AND
|
||||
current_date between cma.validfrom AND coalesce(validto, 'infinity'::date)
|
||||
");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user