Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

23 lignes
548B

  1. defmodule Pleroma.Repo.Migrations.ChatConstraints do
  2. use Ecto.Migration
  3. def change do
  4. remove_orphans = """
  5. delete from chats where not exists(select id from users where ap_id = chats.recipient);
  6. """
  7. execute(remove_orphans)
  8. drop(constraint(:chats, "chats_user_id_fkey"))
  9. alter table(:chats) do
  10. modify(:user_id, references(:users, type: :uuid, on_delete: :delete_all))
  11. modify(
  12. :recipient,
  13. references(:users, column: :ap_id, type: :string, on_delete: :delete_all)
  14. )
  15. end
  16. end
  17. end