Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
| Numéro du ticket | Titre du ticket | |------------------|-----------------| | | | ## Description de la PR ## Modification du .env ## Check list - [x] Pas de régression - [ ] TU/TI/TF rédigée - [x] TU/TI/TF OK - [ ] CHANGELOG modifié Reviewed-on: #3 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
38 lines
825 B
PHP
38 lines
825 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DoctrineMigrations;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
final class Version20260216143100 extends AbstractMigration
|
|
{
|
|
public function getDescription(): string
|
|
{
|
|
return 'Backfill site display_order';
|
|
}
|
|
|
|
public function up(Schema $schema): void
|
|
{
|
|
$this->addSql('
|
|
UPDATE sites s
|
|
SET display_order = ranked.rn
|
|
FROM (
|
|
SELECT id,
|
|
ROW_NUMBER() OVER (
|
|
ORDER BY name ASC, id ASC
|
|
) AS rn
|
|
FROM sites
|
|
) ranked
|
|
WHERE ranked.id = s.id
|
|
');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
// Pas de rollback pertinent.
|
|
}
|
|
}
|