Files
ZelWiki/ZelWiki.Repository/Scripts/AssociatePageFileAttachmentWithPageRevision.sql
2025-02-20 15:20:28 +08:00

22 lines
442 B
SQL

--Remove the previous page file revision attachment, if any.
DELETE FROM PageRevisionAttachment
WHERE
PageId = @PageId
AND PageFileId = @PageFileId
AND FileRevision = @PreviousFileRevision
AND PageRevision = @PageRevision;
--Associate the file revision record with the page revision.
INSERT INTO PageRevisionAttachment
(
PageId,
PageFileId,
FileRevision,
PageRevision
)
SELECT
@PageId,
@PageFileId,
@FileRevision,
@PageRevision;