Commit ff4214fa authored by Ratchanan Srirattanamet's avatar Ratchanan Srirattanamet Committed by Yureka
Browse files

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
parent e6f8aaca
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -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
              '';