Allow to group bookmarks in folders
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
f0468697cd
commit
d415686bb9
21 changed files with 829 additions and 21 deletions
|
|
@ -0,0 +1,27 @@
|
|||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2024 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Repo.Migrations.CreateBookmarkFolders do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create_if_not_exists table(:bookmark_folders, primary_key: false) do
|
||||
add(:id, :uuid, primary_key: true)
|
||||
add(:name, :string, null: false)
|
||||
add(:emoji, :string)
|
||||
add(:user_id, references(:users, type: :uuid, on_delete: :delete_all))
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
alter table(:bookmarks) do
|
||||
add_if_not_exists(
|
||||
:folder_id,
|
||||
references(:bookmark_folders, type: :uuid, on_delete: :nilify_all)
|
||||
)
|
||||
end
|
||||
|
||||
create_if_not_exists(unique_index(:bookmark_folders, [:user_id, :name]))
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue