mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-03-15 18:37:45 +00:00
Resolve "Des codes postaux marqués comme supprimés apparaissent toujours dans la recherche d'adresse"
This commit is contained in:
8
.changes/unreleased/Fixed-20260223-144735.yaml
Normal file
8
.changes/unreleased/Fixed-20260223-144735.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
kind: Fixed
|
||||
body: |
|
||||
Fix: some postal code appears in the UI, although they are marked as deleted
|
||||
time: 2026-02-23T14:47:35.925109983+01:00
|
||||
custom:
|
||||
Issue: "499"
|
||||
MR: "963"
|
||||
SchemaChange: No schema change
|
||||
@@ -79,5 +79,7 @@ final class PostalCodeAPIController extends ApiController
|
||||
|
||||
$qb->andWhere('e.origin = :zero')
|
||||
->setParameter('zero', 0);
|
||||
|
||||
$qb->andWhere('e.deletedAt IS NULL');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,9 @@ final readonly class PostalCodeRepository implements PostalCodeRepositoryInterfa
|
||||
|
||||
$query
|
||||
->setFromClause('chill_main_postal_code cmpc')
|
||||
->andWhereClause('cmpc.origin = 0');
|
||||
->andWhereClause('cmpc.origin = 0')
|
||||
->andWhereClause('cmpc.deletedAt IS NULL')
|
||||
;
|
||||
|
||||
if (null !== $country) {
|
||||
$query->andWhereClause('cmpc.country_id = ?', [$country->getId()]);
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?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 Version20260223134919 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Create a partial index for postal_code search_name_code, to avoid deleted records';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP INDEX public.search_name_code');
|
||||
$this->addSql('CREATE INDEX search_name_code ON public.chill_main_postal_code USING GIN (LOWER(code) gin_trgm_ops, LOWER(label) gin_trgm_ops) WHERE deletedAt IS NULL');
|
||||
$this->addSql('DROP INDEX public.chill_internal_postal_code_canonicalized');
|
||||
$this->addSql('CREATE INDEX chill_internal_postal_code_canonicalized ON chill_main_postal_code USING GIST (canonical gist_trgm_ops) WHERE origin = 0 AND deletedAt IS NULL');
|
||||
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP INDEX public.search_name_code');
|
||||
$this->addSql('CREATE INDEX search_name_code ON chill_main_postal_code USING GIN (LOWER(code) gin_trgm_ops, LOWER(label) gin_trgm_ops)');
|
||||
|
||||
$this->addSql('DROP INDEX public.chill_internal_postal_code_canonicalized');
|
||||
$this->addSql('CREATE INDEX chill_internal_postal_code_canonicalized ON chill_main_postal_code USING GIST (canonical gist_trgm_ops) WHERE origin = 0');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user