Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
645B

  1. defmodule Pleroma.Repo.Migrations.ChangeChatIdToFlake do
  2. use Ecto.Migration
  3. def up do
  4. execute("""
  5. alter table chats
  6. drop constraint chats_pkey cascade,
  7. alter column id drop default,
  8. alter column id set data type uuid using cast( lpad( to_hex(id), 32, '0') as uuid),
  9. add primary key (id)
  10. """)
  11. execute("""
  12. alter table chat_message_references
  13. alter column chat_id set data type uuid using cast( lpad( to_hex(chat_id), 32, '0') as uuid),
  14. add constraint chat_message_references_chat_id_fkey foreign key (chat_id) references chats(id) on delete cascade
  15. """)
  16. end
  17. def down do
  18. :ok
  19. end
  20. end