nixos/kimai: fix upgrading to Kimai 2.32 by clearing cache earlier

During testing of Kimai 2.32, it's been found that fixes done in PR
371917 [^1] is not enough to prevent error in the case of upgrading from
2.31 to 2.32.

Hinted by an upstream issue [^2], make sure that the cache is cleared
before running `kimai:install`, not after. This fixes upgrading from
2.31 to 2.32, and should prevent similar issue from popping up again.

[^1]: https://github.com/NixOS/nixpkgs/pull/371917
[^2]: https://github.com/kimai/kimai/issues/5437
This commit is contained in:
Ratchanan Srirattanamet
2025-04-19 15:42:28 +00:00
committed by Yureka
parent e6f8aaca2b
commit ff4214fabd

View File

@@ -324,12 +324,14 @@ in
${pkg hostName cfg}/bin/console lint:yaml --parse-tags \
${pkg hostName cfg}/share/php/kimai/config
# Run kimai:install to ensure database is created or updated.
# Before running any further console commands, clear cache. This
# avoids errors due to old cache getting used with new version
# of Kimai.
${pkg hostName cfg}/bin/console cache:clear --env=prod
# Then, run kimai:install to ensure database is created or updated.
# Note that kimai:update is an alias to kimai:install.
${pkg hostName cfg}/bin/console kimai:install --no-cache
# Clear cache and warmup cache separately, to avoid "Cannot declare
# class App\Entity\Timesheet" error on first init after upgrade.
${pkg hostName cfg}/bin/console cache:clear --env=prod
# Finally, warm up cache.
${pkg hostName cfg}/bin/console cache:warmup --env=prod
'';