Ensure migrations succeed (#216)
authorfloatingghost <hannah@coffee-and-dreams.uk>
Fri, 16 Sep 2022 11:53:11 +0000 (11:53 +0000)
committerFloatingGhost <hannah@coffee-and-dreams.uk>
Fri, 16 Sep 2022 11:53:45 +0000 (12:53 +0100)
Co-authored-by: FloatingGhost <hannah@coffee-and-dreams.uk>
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/216

priv/repo/migrations/20220718102634_upgrade_oban_to_v11.exs
priv/repo/migrations/20220916115149_ensure_mastofe_settings.exs [new file with mode: 0644]

index eb9c4986c78d9101c8ad724297cd832e6e875095..ba1c849c46bb2bfc7a9d12de64a1095cb4b42b16 100644 (file)
@@ -1,7 +1,10 @@
 defmodule Pleroma.Repo.Migrations.UpgradeObanToV11 do
   use Ecto.Migration
 
-  def up, do: Oban.Migrations.up(version: 11)
+  def up do
+    execute("UPDATE oban_jobs SET priority = 0 WHERE priority IS NULL;")
+    Oban.Migrations.up(version: 11)
+  end
 
   def down, do: Oban.Migrations.down(version: 11)
 end
diff --git a/priv/repo/migrations/20220916115149_ensure_mastofe_settings.exs b/priv/repo/migrations/20220916115149_ensure_mastofe_settings.exs
new file mode 100644 (file)
index 0000000..37880ff
--- /dev/null
@@ -0,0 +1,9 @@
+defmodule Pleroma.Repo.Migrations.EnsureMastofeSettings do
+  use Ecto.Migration
+
+  def change do
+    alter table(:users) do
+      add_if_not_exists(:mastofe_settings, :map)
+    end
+  end
+end