import Since from '@components/shared/Since.astro' import RailroadDiagram from '@components/RailroadDiagram.astro' import Tabs from '@components/Tabs/Tabs.astro' import TabItem from '@components/Tabs/TabItem.astro'

ALTER EVENT statement

The ALTER EVENT statement can be used to modify an existing defined event.

Statement syntax

SurrealQL Syntax

ALTER EVENT [ IF EXISTS ] @name ON [ TABLE ] @table
[ ASYNC [ RETRY @retry ] [ MAXDEPTH @max_depth ] | DROP ASYNC ]
[ WHEN @condition | DROP WHEN ]
[ THEN @action, ... | DROP THEN ]
[ COMMENT @string | DROP COMMENT ]

Example usage

-- Define an event
DEFINE EVENT publish_post ON TABLE post
WHEN $event = "CREATE"
THEN (
UPDATE post SET status = "PUBLISHED" WHERE id = $after.post_id
);

-- Make it async
ALTER EVENT publish_post ON TABLE post ASYNC;