cs: Fix code style (safe rules only).

This commit is contained in:
Pol Dellaiera
2021-11-23 14:06:38 +01:00
parent 149d7ce991
commit 8f96a1121d
1223 changed files with 65199 additions and 64625 deletions

View File

@@ -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\ThirdParty;
@@ -6,22 +15,12 @@ use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* add ThirdParty Entity
* add ThirdParty Entity.
*
* @Author Mathieu Jaumotte jaum_mathieu@collectifs.net
*/
final class Version20190307111314 extends AbstractMigration
{
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE SEQUENCE chill_third_party_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE chill_third_party (id INT NOT NULL, name VARCHAR(255) NOT NULL, telephone VARCHAR(64) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, comment TEXT DEFAULT NULL, type JSON DEFAULT NULL, PRIMARY KEY(id))');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
@@ -29,6 +28,14 @@ final class Version20190307111314 extends AbstractMigration
$this->addSql('DROP SEQUENCE chill_third_party_id_seq CASCADE');
$this->addSql('DROP TABLE chill_third_party');
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE SEQUENCE chill_third_party_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE chill_third_party (id INT NOT NULL, name VARCHAR(255) NOT NULL, telephone VARCHAR(64) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, comment TEXT DEFAULT NULL, type JSON DEFAULT NULL, PRIMARY KEY(id))');
}
}

View File

@@ -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\ThirdParty;
@@ -6,24 +15,24 @@ use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Move table third-party to another schema
* Move table third-party to another schema.
*/
final class Version20190307131650 extends AbstractMigration
{
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql("CREATE SCHEMA chill_3party");
$this->addSql("ALTER TABLE chill_third_party SET SCHEMA chill_3party");
$this->addSql("ALTER TABLE chill_3party.chill_third_party RENAME TO third_party");
$this->addSql("ALTER SEQUENCE chill_third_party_id_seq SET SCHEMA chill_3party");
$this->addSql("ALTER SEQUENCE chill_3party.chill_third_party_id_seq RENAME TO third_party_id_seq");
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->throwIrreversibleMigrationException("The down version of this migration is "
. "not written");
$this->throwIrreversibleMigrationException('The down version of this migration is '
. 'not written');
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA chill_3party');
$this->addSql('ALTER TABLE chill_third_party SET SCHEMA chill_3party');
$this->addSql('ALTER TABLE chill_3party.chill_third_party RENAME TO third_party');
$this->addSql('ALTER SEQUENCE chill_third_party_id_seq SET SCHEMA chill_3party');
$this->addSql('ALTER SEQUENCE chill_3party.chill_third_party_id_seq RENAME TO third_party_id_seq');
}
}

View File

@@ -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\ThirdParty;
@@ -6,10 +15,18 @@ use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Add "centers" and "active" to 3rd party
* Add "centers" and "active" to 3rd party.
*/
final class Version20190418090842 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('DROP TABLE chill_3party.party_center');
$this->addSql('ALTER TABLE chill_3party.third_party DROP active');
}
public function up(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
@@ -21,12 +38,4 @@ final class Version20190418090842 extends AbstractMigration
$this->addSql('ALTER TABLE chill_3party.party_center ADD CONSTRAINT FK_C65D43975932F377 FOREIGN KEY (center_id) REFERENCES centers (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_3party.third_party ADD active BOOLEAN 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('DROP TABLE chill_3party.party_center');
$this->addSql('ALTER TABLE chill_3party.third_party DROP active');
}
}

View File

@@ -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\ThirdParty;
@@ -6,21 +15,20 @@ use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Alter third_party.type to jsonb and rename to types
* Alter third_party.type to jsonb and rename to types.
*/
final class Version20190429171109 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql("ALTER TABLE chill_3party.third_party RENAME COLUMN type "
. "TO types");
$this->addSql("ALTER TABLE chill_3party.third_party ALTER COLUMN types "
. "SET DATA TYPE jsonb");
}
public function down(Schema $schema): void
{
$this->throwIrreversibleMigrationException("not implemented");
$this->throwIrreversibleMigrationException('not implemented');
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_3party.third_party RENAME COLUMN type '
. 'TO types');
$this->addSql('ALTER TABLE chill_3party.third_party ALTER COLUMN types '
. 'SET DATA TYPE jsonb');
}
}

View File

@@ -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\ThirdParty;
@@ -6,10 +15,18 @@ use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Add an address to parties
* Add an address to parties.
*/
final class Version20190502144206 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_3party.third_party DROP CONSTRAINT FK_D952467BF5B7AF75');
$this->addSql('ALTER TABLE chill_3party.third_party DROP address_id');
}
public function up(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
@@ -18,14 +35,5 @@ final class Version20190502144206 extends AbstractMigration
$this->addSql('COMMENT ON COLUMN chill_3party.third_party.types IS NULL');
$this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT FK_D952467BF5B7AF75 FOREIGN KEY (address_id) REFERENCES chill_main_address (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_D952467BF5B7AF75 ON chill_3party.third_party (address_id)');
}
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_3party.third_party DROP CONSTRAINT FK_D952467BF5B7AF75');
$this->addSql('ALTER TABLE chill_3party.third_party DROP address_id');
}
}

View File

@@ -1,5 +1,12 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\Migrations\ThirdParty;
@@ -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 Version20210525211216 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT fk_d952467bf5b7af75');
$this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT fk_d952467bf5b7af75 FOREIGN KEY (address_id) REFERENCES chill_main_address (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 Version20210525211216 extends AbstractMigration
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467BF5B7AF75');
$this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT FK_D952467BF5B7AF75 FOREIGN KEY (address_id) REFERENCES chill_main_address (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT fk_d952467bf5b7af75');
$this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT fk_d952467bf5b7af75 FOREIGN KEY (address_id) REFERENCES chill_main_address (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
}

View File

@@ -1,5 +1,12 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\Migrations\ThirdParty;
@@ -8,11 +15,36 @@ use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Add new fields to ThirdParty Entity
* @author Mathieu Jaumotte mathieu.jaumotte@champs-libres.coop
* Add new fields to ThirdParty Entity.
*/
final class Version20210719105918 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_3party.thirdparty_category DROP CONSTRAINT FK_7049563712469DE2');
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467B384D4799');
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467BBA930D69');
$this->addSql('DROP SEQUENCE chill_3party.party_category_id_seq CASCADE');
$this->addSql('DROP SEQUENCE chill_3party.party_civility_id_seq CASCADE');
$this->addSql('DROP SEQUENCE chill_3party.party_profession_id_seq CASCADE');
$this->addSql('DROP TABLE chill_3party.party_category');
$this->addSql('DROP TABLE chill_3party.party_civility');
$this->addSql('DROP TABLE chill_3party.party_profession');
$this->addSql('DROP TABLE chill_3party.thirdparty_category');
$this->addSql('ALTER INDEX chill_3party.idx_14dc44755932f377 RENAME TO idx_c65d43975932f377');
$this->addSql('ALTER INDEX chill_3party.idx_14dc4475c7d3a8e6 RENAME TO idx_c65d4397c7d3a8e6');
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467B727ACA70');
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467B16FE72E1');
$this->addSql('ALTER TABLE chill_3party.third_party DROP parent_id');
$this->addSql('ALTER TABLE chill_3party.third_party DROP civility');
$this->addSql('ALTER TABLE chill_3party.third_party DROP profession');
$this->addSql('ALTER TABLE chill_3party.third_party DROP updated_by');
$this->addSql('ALTER TABLE chill_3party.third_party DROP name_company');
$this->addSql('ALTER TABLE chill_3party.third_party DROP acronym');
$this->addSql('ALTER TABLE chill_3party.third_party DROP created_at');
$this->addSql('ALTER TABLE chill_3party.third_party DROP updated_at');
}
public function getDescription(): string
{
return 'Add new fields to ThirdParty Entity + new join tables';
@@ -50,30 +82,4 @@ final class Version20210719105918 extends AbstractMigration
$this->addSql('ALTER INDEX chill_3party.idx_c65d4397c7d3a8e6 RENAME TO IDX_14DC4475C7D3A8E6');
$this->addSql('ALTER INDEX chill_3party.idx_c65d43975932f377 RENAME TO IDX_14DC44755932F377');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_3party.thirdparty_category DROP CONSTRAINT FK_7049563712469DE2');
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467B384D4799');
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467BBA930D69');
$this->addSql('DROP SEQUENCE chill_3party.party_category_id_seq CASCADE');
$this->addSql('DROP SEQUENCE chill_3party.party_civility_id_seq CASCADE');
$this->addSql('DROP SEQUENCE chill_3party.party_profession_id_seq CASCADE');
$this->addSql('DROP TABLE chill_3party.party_category');
$this->addSql('DROP TABLE chill_3party.party_civility');
$this->addSql('DROP TABLE chill_3party.party_profession');
$this->addSql('DROP TABLE chill_3party.thirdparty_category');
$this->addSql('ALTER INDEX chill_3party.idx_14dc44755932f377 RENAME TO idx_c65d43975932f377');
$this->addSql('ALTER INDEX chill_3party.idx_14dc4475c7d3a8e6 RENAME TO idx_c65d4397c7d3a8e6');
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467B727ACA70');
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467B16FE72E1');
$this->addSql('ALTER TABLE chill_3party.third_party DROP parent_id');
$this->addSql('ALTER TABLE chill_3party.third_party DROP civility');
$this->addSql('ALTER TABLE chill_3party.third_party DROP profession');
$this->addSql('ALTER TABLE chill_3party.third_party DROP updated_by');
$this->addSql('ALTER TABLE chill_3party.third_party DROP name_company');
$this->addSql('ALTER TABLE chill_3party.third_party DROP acronym');
$this->addSql('ALTER TABLE chill_3party.third_party DROP created_at');
$this->addSql('ALTER TABLE chill_3party.third_party DROP updated_at');
}
}

View File

@@ -1,5 +1,12 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\Migrations\ThirdParty;
@@ -8,10 +15,15 @@ use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Add created_by to third party
* Add created_by to third party.
*/
final class Version20211006200924 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_3party.third_party DROP created_by');
}
public function getDescription(): string
{
return 'Add link to creator (created_by) to thirdParty';
@@ -19,19 +31,14 @@ final class Version20211006200924 extends AbstractMigration
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_3party.third_party ADD created_by INT DEFAULT NULL');
$this->addSql('ALTER TABLE chill_3party.third_party ALTER created_at TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
$this->addSql('ALTER TABLE chill_3party.third_party ALTER created_at DROP DEFAULT');
$this->addSql('ALTER TABLE chill_3party.third_party ALTER updated_at TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
$this->addSql('ALTER TABLE chill_3party.third_party ALTER updated_at DROP DEFAULT');
$this->addSql('COMMENT ON COLUMN chill_3party.third_party.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN chill_3party.third_party.updated_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT FK_D952467BDE12AB56 FOREIGN KEY (created_by) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_D952467BDE12AB56 ON chill_3party.third_party (created_by)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_3party.third_party DROP created_by');
$this->addSql('ALTER TABLE chill_3party.third_party ADD created_by INT DEFAULT NULL');
$this->addSql('ALTER TABLE chill_3party.third_party ALTER created_at TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
$this->addSql('ALTER TABLE chill_3party.third_party ALTER created_at DROP DEFAULT');
$this->addSql('ALTER TABLE chill_3party.third_party ALTER updated_at TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
$this->addSql('ALTER TABLE chill_3party.third_party ALTER updated_at DROP DEFAULT');
$this->addSql('COMMENT ON COLUMN chill_3party.third_party.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN chill_3party.third_party.updated_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT FK_D952467BDE12AB56 FOREIGN KEY (created_by) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_D952467BDE12AB56 ON chill_3party.third_party (created_by)');
}
}

View File

@@ -1,5 +1,12 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\Migrations\ThirdParty;
@@ -8,10 +15,31 @@ use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* migrate data from 3party.civility to chill_main_civility table
* migrate data from 3party.civility to chill_main_civility table.
*/
final class Version20211007150459 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->throwIrreversibleMigrationException('Reversible migration not implemented');
// for reference:
$this->addSql('CREATE SEQUENCE chill_3party.party_civility_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE chill_3party.party_civility (id INT NOT NULL, name JSON NOT NULL, active BOOLEAN NOT NULL, PRIMARY KEY(id))');
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467B23D6A298');
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467BFDEF8996');
$this->addSql('ALTER TABLE chill_3party.third_party ADD civility INT DEFAULT NULL');
$this->addSql('ALTER TABLE chill_3party.third_party ADD profession INT DEFAULT NULL');
$this->addSql('ALTER TABLE chill_3party.third_party DROP civility_id');
$this->addSql('ALTER TABLE chill_3party.third_party DROP profession_id');
$this->addSql('ALTER TABLE chill_3party.third_party DROP kind');
$this->addSql('ALTER TABLE chill_3party.third_party DROP canonicalized');
$this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT fk_d952467b384d4799 FOREIGN KEY (civility) REFERENCES chill_3party.party_civility (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT fk_d952467bba930d69 FOREIGN KEY (profession) REFERENCES chill_3party.party_profession (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE UNIQUE INDEX uniq_d952467b384d4799 ON chill_3party.third_party (civility)');
$this->addSql('CREATE UNIQUE INDEX uniq_d952467bba930d69 ON chill_3party.third_party (profession)');
}
public function getDescription(): string
{
return 'migrate data from 3party.civility to chill_main_civility table';
@@ -45,25 +73,4 @@ final class Version20211007150459 extends AbstractMigration
$this->addSql('CREATE INDEX IDX_D952467B23D6A298 ON chill_3party.third_party (civility_id)');
$this->addSql('CREATE INDEX IDX_D952467BFDEF8996 ON chill_3party.third_party (profession_id)');
}
public function down(Schema $schema): void
{
$this->throwIrreversibleMigrationException('Reversible migration not implemented');
// for reference:
$this->addSql('CREATE SEQUENCE chill_3party.party_civility_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE chill_3party.party_civility (id INT NOT NULL, name JSON NOT NULL, active BOOLEAN NOT NULL, PRIMARY KEY(id))');
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467B23D6A298');
$this->addSql('ALTER TABLE chill_3party.third_party DROP CONSTRAINT FK_D952467BFDEF8996');
$this->addSql('ALTER TABLE chill_3party.third_party ADD civility INT DEFAULT NULL');
$this->addSql('ALTER TABLE chill_3party.third_party ADD profession INT DEFAULT NULL');
$this->addSql('ALTER TABLE chill_3party.third_party DROP civility_id');
$this->addSql('ALTER TABLE chill_3party.third_party DROP profession_id');
$this->addSql('ALTER TABLE chill_3party.third_party DROP kind');
$this->addSql('ALTER TABLE chill_3party.third_party DROP canonicalized');
$this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT fk_d952467b384d4799 FOREIGN KEY (civility) REFERENCES chill_3party.party_civility (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_3party.third_party ADD CONSTRAINT fk_d952467bba930d69 FOREIGN KEY (profession) REFERENCES chill_3party.party_profession (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE UNIQUE INDEX uniq_d952467b384d4799 ON chill_3party.third_party (civility)');
$this->addSql('CREATE UNIQUE INDEX uniq_d952467bba930d69 ON chill_3party.third_party (profession)');
}
}

View File

@@ -1,5 +1,12 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\Migrations\ThirdParty;
@@ -8,10 +15,20 @@ use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Create trigger for canonicalisation on 3party + indexes
* Create trigger for canonicalisation on 3party + indexes.
*/
final class Version20211007165001 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->addSql('DROP TRIGGER canonicalize_fullname_on_update ON chill_3party.third_party');
$this->addSql('DROP TRIGGER canonicalize_fullname_on_insert ON chill_3party.third_party');
$this->addSql('DROP FUNCTION chill_3party.canonicalize()');
$this->addSql('
DROP INDEX chill_3party.chill_custom_canonicalized_trgm_idx_gist
');
}
public function getDescription(): string
{
return 'Create trigger for canonicalisation on 3party + indexes';
@@ -54,33 +71,23 @@ final class Version20211007165001 extends AbstractMigration
END
$$
");
$this->addSql("
$this->addSql('
CREATE TRIGGER canonicalize_fullname_on_insert
BEFORE INSERT
ON chill_3party.third_party
FOR EACH ROW
EXECUTE procedure chill_3party.canonicalize();
");
$this->addSql("
');
$this->addSql('
CREATE TRIGGER canonicalize_fullname_on_update
BEFORE UPDATE
ON chill_3party.third_party
FOR EACH ROW
EXECUTE procedure chill_3party.canonicalize();
");
$this->addSql("
');
$this->addSql('
CREATE INDEX chill_custom_canonicalized_trgm_idx_gist
ON chill_3party.third_party USING GIST (canonicalized gist_trgm_ops) WHERE active IS TRUE
");
}
public function down(Schema $schema): void
{
$this->addSql('DROP TRIGGER canonicalize_fullname_on_update ON chill_3party.third_party');
$this->addSql('DROP TRIGGER canonicalize_fullname_on_insert ON chill_3party.third_party');
$this->addSql('DROP FUNCTION chill_3party.canonicalize()');
$this->addSql("
DROP INDEX chill_3party.chill_custom_canonicalized_trgm_idx_gist
");
');
}
}

View File

@@ -1,5 +1,12 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\Migrations\ThirdParty;
@@ -8,10 +15,15 @@ use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Add anonymous flag for contacts
* Add anonymous flag for contacts.
*/
final class Version20211007194942 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_3party.third_party DROP contact_data_anonymous');
}
public function getDescription(): string
{
return 'Add anonymous flag for contacts';
@@ -21,9 +33,4 @@ final class Version20211007194942 extends AbstractMigration
{
$this->addSql('ALTER TABLE chill_3party.third_party ADD contact_data_anonymous BOOLEAN DEFAULT \'false\' NOT NULL;');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_3party.third_party DROP contact_data_anonymous');
}
}