feat: select position when creating a new card

This commit is contained in:
Henry
2024-07-26 09:59:48 +01:00
parent d334607a9c
commit 9931a585a5
5 changed files with 69 additions and 4 deletions

View File

@@ -66,3 +66,12 @@ AS $$
WHERE "listId" = list_id AND index > card_index AND "deletedAt" IS NULL;
$$;
CREATE OR REPLACE FUNCTION push_card_index(list_id BIGINT, card_index INT)
RETURNS VOID
LANGUAGE SQL
AS $$
UPDATE card
SET index = index + 1
WHERE "listId" = list_id AND index >= card_index AND "deletedAt" IS NULL;
$$;