This commit is contained in:
seb
2026-08-01 03:37:45 +02:00
parent 69a24192d3
commit 1756dc7ef0
10 changed files with 179 additions and 13 deletions

50
src/sql/articleDelete.js Normal file
View File

@@ -0,0 +1,50 @@
export const GET_CHILD_COUNT = `
SELECT COUNT(*) AS count
FROM article
WHERE fatherarticle_id = @articleId
`;
export const GET_LIST_IDS = `
SELECT articlelist_id AS articlelistId, optionslist_id AS optionslistId
FROM article
WHERE id = @articleId
`;
export const GET_NAME_FOR_DELETE = `
SELECT TOP 1 at.name
FROM articletext at
WHERE at.article_id = @articleId AND at.language_id = @languageId
`;
export const DETACH_MANIFEST_ARTICLES = `
UPDATE manifestarticle
SET article_id = NULL,
comment = CONCAT(
ISNULL(comment, ''),
CASE WHEN comment IS NULL OR comment = '' THEN '' ELSE ' ' END,
@suffix
)
WHERE article_id = @articleId
`;
export const DELETE_PICS_BY_ARTICLE = `
DELETE p
FROM pic p
INNER JOIN articlepic ap ON ap.pic_id = p.id
WHERE ap.article_id = @articleId
`;
export const DELETE_BY_ID = `
DELETE FROM article
WHERE id = @articleId
`;
export const DELETE_ARTICLELIST = `
DELETE FROM articlelist
WHERE id = @id
`;
export const DELETE_OPTIONSLIST = `
DELETE FROM optionslist
WHERE id = @id
`;