Files
FreshRSS/app/Models/CategoryDAOPGSQL.php
Alexandre Alapetite 5e8c964f6c Stable IDs during SQL import (#7988)
* Stable IDs during SQL import
Follow-up of https://github.com/FreshRSS/FreshRSS/pull/7949
Make sure that the original category IDs, feed IDs, and label IDs are kept identical during an SQL import.
Avoid breaking everything referring to categories, feeds, labels by their IDs such as searches and third-party extensions.

* Fix export of default category
2025-09-27 15:11:55 +02:00

14 lines
317 B
PHP

<?php
declare(strict_types=1);
final class FreshRSS_CategoryDAOPGSQL extends FreshRSS_CategoryDAO {
#[\Override]
public function sqlResetSequence(): bool {
$sql = <<<'SQL'
SELECT setval('`_category_id_seq`', COALESCE(MAX(id), 0) + 1, false) FROM `_category`
SQL;
return $this->pdo->exec($sql) !== false;
}
}