From 3886304c54172deec30033934875a2b3b69ebc92 Mon Sep 17 00:00:00 2001 From: Connor Rigby Date: Mon, 18 Nov 2019 14:32:55 -0800 Subject: [PATCH] Force farmware to be reinstalled. This has to be done because v8 was shipped with a configuration error causing farmware to install to the temporary data partition on the raspberry pi. --- ...0191118222042_force_reinstall_farmware.exs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 farmbot_core/priv/asset/migrations/20191118222042_force_reinstall_farmware.exs diff --git a/farmbot_core/priv/asset/migrations/20191118222042_force_reinstall_farmware.exs b/farmbot_core/priv/asset/migrations/20191118222042_force_reinstall_farmware.exs new file mode 100644 index 00000000..5dc9a301 --- /dev/null +++ b/farmbot_core/priv/asset/migrations/20191118222042_force_reinstall_farmware.exs @@ -0,0 +1,20 @@ +defmodule FarmbotCore.Asset.Repo.Migrations.ForceReinstallFarmware do + use Ecto.Migration + + alias FarmbotCore.Asset.{ + Repo, + FirstPartyFarmware, + FarmwareInstallation + } + + # this migration is here because v8 was shipped with a configuration error + # causing farmware to install to the temporary data partition on the + # raspberry pi. + def change do + for %{manifest: %{}} = fwi <- Repo.all(FirstPartyFarmware), + do: Repo.update!(FirstPartyFarmware.changeset(fwi, %{manifest: nil})) + + for %{manifest: %{}} = fwi <- Repo.all(FarmwareInstallation), + do: Repo.update!(FarmwareInstallation.changeset(fwi, %{manifest: nil})) + end +end