logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/

20200607112923_change_chat_id_to_flake.exs (804B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Repo.Migrations.ChangeChatIdToFlake do
  5. use Ecto.Migration
  6. def up do
  7. execute("""
  8. alter table chats
  9. drop constraint chats_pkey cascade,
  10. alter column id drop default,
  11. alter column id set data type uuid using cast( lpad( to_hex(id), 32, '0') as uuid),
  12. add primary key (id)
  13. """)
  14. execute("""
  15. alter table chat_message_references
  16. alter column chat_id set data type uuid using cast( lpad( to_hex(chat_id), 32, '0') as uuid),
  17. add constraint chat_message_references_chat_id_fkey foreign key (chat_id) references chats(id) on delete cascade
  18. """)
  19. end
  20. def down do
  21. :ok
  22. end
  23. end