Merge remote-tracking branch 'origin/master' into refactor-using-rector-202303

This commit is contained in:
2023-04-15 00:07:09 +02:00
143 changed files with 3395 additions and 1300 deletions

View File

@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\Migrations\Main;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20230306142148 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add columns refStatus and refStatusLastUpdate to Address';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_main_address ADD refStatus TEXT DEFAULT \'match\' NOT NULL');
$this->addSql('ALTER TABLE chill_main_address ADD refStatusLastUpdate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL');
// we must set the last status update to the address reference date to avoid inconsistencies
$this->addSql('UPDATE chill_main_address a SET refStatusLastUpdate = COALESCE(r.updatedat, r.createdat, \'1970-01-01\'::timestamp) FROM chill_main_address_reference r WHERE a.addressreference_id = r.id');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_main_address DROP refStatus');
$this->addSql('ALTER TABLE chill_main_address DROP refStatusLastUpdate');
}
}

View File

@@ -0,0 +1,116 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\Migrations\Main;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20230306145728 extends AbstractMigration
{
public function getDescription(): string
{
return 'fix inconsistencies in chill_main_address table';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_main_address ADD createdAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
$this->addSql('ALTER TABLE chill_main_address ADD updatedAt TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
$this->addSql('ALTER TABLE chill_main_address ADD createdBy_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE chill_main_address ADD updatedBy_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER street TYPE TEXT');
$this->addSql('UPDATE chill_main_address SET street=\'\' WHERE street IS NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER street SET DEFAULT \'\'');
$this->addSql('ALTER TABLE chill_main_address ALTER streetnumber TYPE TEXT');
$this->addSql('UPDATE chill_main_address SET streetnumber=\'\' WHERE streetnumber IS NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER streetnumber SET DEFAULT \'\'');
$this->addSql('ALTER TABLE chill_main_address ALTER floor SET DEFAULT \'\'');
$this->addSql('UPDATE chill_main_address SET floor=\'\' WHERE floor IS NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER floor SET NOT NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER corridor SET DEFAULT \'\'');
$this->addSql('UPDATE chill_main_address SET corridor=\'\' WHERE corridor IS NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER corridor SET NOT NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER steps SET DEFAULT \'\'');
$this->addSql('UPDATE chill_main_address SET steps=\'\' WHERE steps IS NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER steps SET NOT NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER buildingname TYPE TEXT');
$this->addSql('ALTER TABLE chill_main_address ALTER buildingname SET DEFAULT \'\'');
$this->addSql('UPDATE chill_main_address SET buildingname=\'\' WHERE buildingname IS NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER buildingname SET NOT NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER flat SET DEFAULT \'\'');
$this->addSql('UPDATE chill_main_address SET flat=\'\' WHERE flat IS NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER flat SET NOT NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER distribution TYPE TEXT');
$this->addSql('ALTER TABLE chill_main_address ALTER distribution SET DEFAULT \'\'');
$this->addSql('UPDATE chill_main_address SET distribution=\'\' WHERE distribution IS NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER distribution SET NOT NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER extra TYPE TEXT');
$this->addSql('ALTER TABLE chill_main_address ALTER extra SET DEFAULT \'\'');
$this->addSql('UPDATE chill_main_address SET extra=\'\' WHERE extra IS NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER extra SET NOT NULL');
$this->addSql('UPDATE chill_main_address SET confidential=FALSE WHERE confidential IS NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER confidential SET NOT NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER refstatuslastupdate TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
$this->addSql('COMMENT ON COLUMN chill_main_address.point IS \'(DC2Type:point)\'');
$this->addSql('COMMENT ON COLUMN chill_main_address.createdAt IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN chill_main_address.updatedAt IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN chill_main_address.refStatusLastUpdate IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('ALTER TABLE chill_main_address ADD CONSTRAINT FK_165051F63174800F FOREIGN KEY (createdBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_main_address ADD CONSTRAINT FK_165051F665FF1AEC FOREIGN KEY (updatedBy_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_165051F63174800F ON chill_main_address (createdBy_id)');
$this->addSql('CREATE INDEX IDX_165051F665FF1AEC ON chill_main_address (updatedBy_id)');
$this->addSql('COMMENT ON COLUMN chill_main_address_reference.point IS \'(DC2Type:point)\'');
}
public function down(Schema $schema): void
{
$this->throwIrreversibleMigrationException('down method is not double-checked');
$this->addSql('ALTER TABLE chill_main_address DROP CONSTRAINT FK_165051F63174800F');
$this->addSql('ALTER TABLE chill_main_address DROP CONSTRAINT FK_165051F665FF1AEC');
$this->addSql('DROP INDEX IDX_165051F63174800F');
$this->addSql('DROP INDEX IDX_165051F665FF1AEC');
$this->addSql('ALTER TABLE chill_main_address ADD customs JSONB DEFAULT \'[]\'');
$this->addSql('ALTER TABLE chill_main_address DROP createdAt');
$this->addSql('ALTER TABLE chill_main_address DROP updatedAt');
$this->addSql('ALTER TABLE chill_main_address DROP createdBy_id');
$this->addSql('ALTER TABLE chill_main_address DROP updatedBy_id');
$this->addSql('ALTER TABLE chill_main_address ALTER buildingName TYPE VARCHAR(255)');
$this->addSql('ALTER TABLE chill_main_address ALTER buildingName DROP DEFAULT');
$this->addSql('ALTER TABLE chill_main_address ALTER buildingName DROP NOT NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER confidential SET DEFAULT false');
$this->addSql('ALTER TABLE chill_main_address ALTER confidential DROP NOT NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER corridor DROP DEFAULT');
$this->addSql('ALTER TABLE chill_main_address ALTER corridor DROP NOT NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER distribution TYPE VARCHAR(255)');
$this->addSql('ALTER TABLE chill_main_address ALTER distribution DROP DEFAULT');
$this->addSql('ALTER TABLE chill_main_address ALTER distribution DROP NOT NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER extra TYPE VARCHAR(255)');
$this->addSql('ALTER TABLE chill_main_address ALTER extra DROP DEFAULT');
$this->addSql('ALTER TABLE chill_main_address ALTER extra DROP NOT NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER flat DROP DEFAULT');
$this->addSql('ALTER TABLE chill_main_address ALTER flat DROP NOT NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER floor DROP DEFAULT');
$this->addSql('ALTER TABLE chill_main_address ALTER floor DROP NOT NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER isNoAddress SET DEFAULT false');
$this->addSql('ALTER TABLE chill_main_address ALTER point TYPE VARCHAR(255)');
$this->addSql('ALTER TABLE chill_main_address ALTER refStatusLastUpdate TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
$this->addSql('ALTER TABLE chill_main_address ALTER steps DROP DEFAULT');
$this->addSql('ALTER TABLE chill_main_address ALTER steps DROP NOT NULL');
$this->addSql('ALTER TABLE chill_main_address ALTER street TYPE VARCHAR(255)');
$this->addSql('ALTER TABLE chill_main_address ALTER street DROP DEFAULT');
$this->addSql('ALTER TABLE chill_main_address ALTER streetNumber TYPE VARCHAR(255)');
$this->addSql('ALTER TABLE chill_main_address ALTER streetNumber DROP DEFAULT');
$this->addSql('COMMENT ON COLUMN chill_main_address.refstatuslastupdate IS NULL');
}
}

View File

@@ -0,0 +1,65 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\Migrations\Main;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20230306151218 extends AbstractMigration
{
public function getDescription(): string
{
return 'fix inconsistencies in chill_main_address_reference table';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_main_address_reference ALTER refid TYPE TEXT');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER refid SET DEFAULT \'\'');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER street TYPE TEXT');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER street SET DEFAULT \'\'');
$this->addSql('UPDATE chill_main_address_reference SET street = \'\' WHERE street IS NULL');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER street SET NOT NULL');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER streetnumber TYPE TEXT');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER streetnumber SET DEFAULT \'\'');
$this->addSql('UPDATE chill_main_address_reference SET streetnumber = \'\' WHERE streetnumber IS NULL');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER streetnumber SET NOT NULL');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER municipalitycode TYPE TEXT');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER municipalitycode SET DEFAULT \'\'');
$this->addSql('UPDATE chill_main_address_reference SET municipalitycode = \'\' WHERE municipalitycode IS NULL');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER municipalitycode SET NOT NULL');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER source TYPE TEXT');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER source SET DEFAULT \'\'');
$this->addSql('UPDATE chill_main_address_reference SET source = \'\' WHERE source IS NULL');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER source SET NOT NULL');
}
public function down(Schema $schema): void
{
$this->throwIrreversibleMigrationException('not double-checked');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER municipalityCode TYPE VARCHAR(255)');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER municipalityCode DROP DEFAULT');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER municipalityCode DROP NOT NULL');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER refId TYPE VARCHAR(255)');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER refId DROP DEFAULT');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER source TYPE VARCHAR(255)');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER source DROP DEFAULT');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER source DROP NOT NULL');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER street TYPE VARCHAR(255)');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER street DROP DEFAULT');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER street DROP NOT NULL');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER streetNumber TYPE VARCHAR(255)');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER streetNumber DROP DEFAULT');
$this->addSql('ALTER TABLE chill_main_address_reference ALTER streetNumber DROP NOT NULL');
}
}

View File

@@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\Migrations\Main;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20230321134155 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_main_workflow_entity_step_cc_user DROP CONSTRAINT FK_9FC79037E6AF9D4');
$this->addSql('ALTER TABLE chill_main_workflow_entity_step_cc_user DROP CONSTRAINT FK_9FC7903A76ED395');
$this->addSql('DROP TABLE chill_main_workflow_entity_step_cc_user');
}
public function getDescription(): string
{
return 'Add cc User to workflow step';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE chill_main_workflow_entity_step_cc_user (entityworkflowstep_id INT NOT NULL, user_id INT NOT NULL, PRIMARY KEY(entityworkflowstep_id, user_id))');
$this->addSql('CREATE INDEX IDX_9FC79037E6AF9D4 ON chill_main_workflow_entity_step_cc_user (entityworkflowstep_id)');
$this->addSql('CREATE INDEX IDX_9FC7903A76ED395 ON chill_main_workflow_entity_step_cc_user (user_id)');
$this->addSql('ALTER TABLE chill_main_workflow_entity_step_cc_user ADD CONSTRAINT FK_9FC79037E6AF9D4 FOREIGN KEY (entityworkflowstep_id) REFERENCES chill_main_workflow_entity_step (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE chill_main_workflow_entity_step_cc_user ADD CONSTRAINT FK_9FC7903A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
}