Fix SigningKey db schema

This commit is contained in:
Oneric 2025-01-11 21:25:00 +01:00
parent 3460f41776
commit 2a4587f201

View file

@ -0,0 +1,24 @@
defmodule Pleroma.Repo.Migrations.SigningKeyNullability do
use Ecto.Migration
import Ecto.Query
def up() do
# Delete existing NULL entries; they are useless
Pleroma.User.SigningKey
|> where([s], is_nil(s.user_id) or is_nil(s.public_key))
|> Pleroma.Repo.delete_all()
alter table(:signing_keys) do
modify :user_id, :uuid, null: false
modify :public_key, :text, null: false
end
end
def down() do
alter table(:signing_keys) do
modify :user_id, :uuid, null: true
modify :public_key, :text, null: true
end
end
end