mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
fix cs
This commit is contained in:
@@ -198,7 +198,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
|
||||
private ?string $email = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="firstname", type="text", options={"default":""})
|
||||
* @ORM\Column(name="firstname", type="text", options={"default": ""})
|
||||
* @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"})
|
||||
*/
|
||||
private string $firstname = '';
|
||||
|
@@ -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;
|
||||
@@ -9,6 +16,45 @@ use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20220324175549 extends AbstractMigration
|
||||
{
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql("
|
||||
CREATE OR REPLACE FUNCTION chill_3party.canonicalize() RETURNS TRIGGER
|
||||
LANGUAGE plpgsql
|
||||
AS
|
||||
$$
|
||||
BEGIN
|
||||
NEW.canonicalized =
|
||||
UNACCENT(
|
||||
LOWER(
|
||||
NEW.name ||
|
||||
CASE WHEN COALESCE(NEW.name_company, '') <> '' THEN ' ' ELSE '' END ||
|
||||
COALESCE(NEW.name_company, '') ||
|
||||
CASE WHEN COALESCE(NEW.acronym, '') <> '' THEN ' ' ELSE '' END ||
|
||||
COALESCE(NEW.acronym, '')
|
||||
)
|
||||
)
|
||||
;
|
||||
|
||||
return NEW;
|
||||
END
|
||||
$$
|
||||
");
|
||||
$this->addSql("
|
||||
UPDATE chill_3party.third_party
|
||||
SET canonicalized =
|
||||
UNACCENT(
|
||||
LOWER(
|
||||
name ||
|
||||
CASE WHEN COALESCE(name_company, '') <> '' THEN ' ' ELSE '' END ||
|
||||
COALESCE(name_company, '') ||
|
||||
CASE WHEN COALESCE(acronym, '') <> '' THEN ' ' ELSE '' END ||
|
||||
COALESCE(acronym, '')
|
||||
)
|
||||
)
|
||||
");
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'indexing of firstname on third parties';
|
||||
@@ -55,45 +101,5 @@ final class Version20220324175549 extends AbstractMigration
|
||||
END
|
||||
$$
|
||||
");
|
||||
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql("
|
||||
CREATE OR REPLACE FUNCTION chill_3party.canonicalize() RETURNS TRIGGER
|
||||
LANGUAGE plpgsql
|
||||
AS
|
||||
$$
|
||||
BEGIN
|
||||
NEW.canonicalized =
|
||||
UNACCENT(
|
||||
LOWER(
|
||||
NEW.name ||
|
||||
CASE WHEN COALESCE(NEW.name_company, '') <> '' THEN ' ' ELSE '' END ||
|
||||
COALESCE(NEW.name_company, '') ||
|
||||
CASE WHEN COALESCE(NEW.acronym, '') <> '' THEN ' ' ELSE '' END ||
|
||||
COALESCE(NEW.acronym, '')
|
||||
)
|
||||
)
|
||||
;
|
||||
|
||||
return NEW;
|
||||
END
|
||||
$$
|
||||
");
|
||||
$this->addSql("
|
||||
UPDATE chill_3party.third_party
|
||||
SET canonicalized =
|
||||
UNACCENT(
|
||||
LOWER(
|
||||
name ||
|
||||
CASE WHEN COALESCE(name_company, '') <> '' THEN ' ' ELSE '' END ||
|
||||
COALESCE(name_company, '') ||
|
||||
CASE WHEN COALESCE(acronym, '') <> '' THEN ' ' ELSE '' END ||
|
||||
COALESCE(acronym, '')
|
||||
)
|
||||
)
|
||||
");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user