Fix oban jobs migrations (especially on PostgreSQL < 12)

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2020-11-14 18:55:14 +01:00
parent 4f9a03f523
commit d8323c8e5c
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
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