Merge branch 'fix-oban-migration' into 'master'

Fix oban jobs migrations (especially on PostgreSQL < 12)

See merge request framasoft/mobilizon!701
This commit is contained in:
Thomas Citharel 2020-11-14 19:12:59 +01:00
commit 95dafcecee
2 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,15 @@
defmodule Mobilizon.Storage.Repo.Migrations.FixObanMigrationsForOlderPostgreSQLVersions do
use Ecto.Migration
@disable_ddl_transaction true
def up do
Ecto.Adapters.SQL.query!(
Mobilizon.Storage.Repo,
"ALTER TYPE oban_job_state ADD VALUE IF NOT EXISTS 'cancelled'"
)
end
def down do
IO.puts("This migration doesn't handle being reverted.")
end
end

View File

@ -0,0 +1,6 @@
defmodule Mobilizon.Storage.Repo.Migrations.UpgradeObanJobsToV9 do
use Ecto.Migration
defdelegate up, to: Oban.Migrations
defdelegate down, to: Oban.Migrations
end