logo

pleroma

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

20240223165000_create_bookmark_folders.exs (797B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2024 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Repo.Migrations.CreateBookmarkFolders do
  5. use Ecto.Migration
  6. def change do
  7. create_if_not_exists table(:bookmark_folders, primary_key: false) do
  8. add(:id, :uuid, primary_key: true)
  9. add(:name, :string, null: false)
  10. add(:emoji, :string)
  11. add(:user_id, references(:users, type: :uuid, on_delete: :delete_all))
  12. timestamps()
  13. end
  14. alter table(:bookmarks) do
  15. add_if_not_exists(
  16. :folder_id,
  17. references(:bookmark_folders, type: :uuid, on_delete: :nilify_all)
  18. )
  19. end
  20. create_if_not_exists(unique_index(:bookmark_folders, [:user_id, :name]))
  21. end
  22. end