Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retirer l'outillage fr_city car il n'est plus utilisé #1163

Open
florimondmanca opened this issue Jan 22, 2025 · 1 comment
Open

Retirer l'outillage fr_city car il n'est plus utilisé #1163

florimondmanca opened this issue Jan 22, 2025 · 1 comment
Labels

Comments

@florimondmanca
Copy link
Collaborator

florimondmanca commented Jan 22, 2025

Sauf erreur, on a du code mort issu de la PR #569

J'imagine qu'on voulait s'en servir pour le géocodage, avant qu'on ne passe tout sur la BDTOPO

Ceci afin de pouvoir faire des recherches dans la liste de communes.

Mais la recherche de villes est faite avec l'API Adresse maintenant, via la PR #572

Je propose donc de retirer tout ça :

  • data/fr_city.sql
  • La table Country\France\City
  • Le CityRepository
  • Le mkfrcitydata dans le Makefile
  • (Non exhaustif)
@github-project-automation github-project-automation bot moved this to Backlog in DiaLog Jan 22, 2025
@florimondmanca florimondmanca moved this from Backlog to Prêt à développer in DiaLog Jan 22, 2025
@florimondmanca florimondmanca changed the title L'outillage fr_city n'est plus utilisé Retirer l'outillage fr_city car il n'est plus utilisé Jan 22, 2025
@florimondmanca
Copy link
Collaborator Author

Hmm OK en fait la seule référence restante à cette table est dans cette migration...

public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE location ALTER COLUMN address DROP NOT NULL;');
$this->addSql('ALTER TABLE location ADD city_code VARCHAR(5)');
$this->addSql('ALTER TABLE location ADD city_name VARCHAR(255)');
$this->addSql('ALTER TABLE location ADD city_postcode VARCHAR(255)');
$this->addSql('ALTER TABLE location ADD road_name VARCHAR(255)');
$this->addSql("UPDATE location SET road_name = substring(address from '^([^\d,]+),? \d{5}');");
$this->addSql("UPDATE location SET city_name = substring(address from '\d{5} (.+)\$');");
$this->addSql("UPDATE location SET city_postcode = substring(address from '(\d{5}) .+\$');");
$this->addSql("
UPDATE location SET city_code = (
CASE
WHEN city_name = 'Paris' THEN '751' || substring(address from '750(\d{2}) .+\$')
WHEN city_name = 'Marseille' THEN '132' || substring(address from '130(\d{2}) .+\$')
WHEN city_name = 'Lyon' THEN '6938' || substring(address from '6900(\d) .+\$')
ELSE (
SELECT insee_code FROM fr_city AS c
WHERE c.departement = substring(address from '(\d{2})\d{3} .+\$')
AND lower(c.name) = lower(city_name)
)
END
)
");
$this->addSql('ALTER TABLE location ADD city_label VARCHAR(255)');
$this->addSql("UPDATE location SET city_label = city_name || ' (' || city_postcode || ')'");
$this->addSql('ALTER TABLE location DROP city_name');
$this->addSql('ALTER TABLE location DROP city_postcode');
$this->addSql('ALTER TABLE location ALTER COLUMN city_code SET NOT NULL');
$this->addSql('ALTER TABLE location ALTER COLUMN city_label SET NOT NULL');
}

Elle date de #572

Si on retire tout ce qui concerne fr_city mais qu'on ne change pas cette migration, un clean install échouerait car cette migration ne passerait plus

Or depuis tous les environnements ont été migrés, et sur un clean install l'UPDATE ne ferait rien. Est-ce qu'il y a lieu de la garder ? On peut peut-être juste retirer ce addSql ? Qu'en dis tu @mmarchois ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Prêt à développer
Development

No branches or pull requests

1 participant