defmodule ExSQL.AST.CreateTrigger do
@moduledoc """
A `CREATE TRIGGER` statement.
`timing` is `:before`, `:after`, or `:instead_of`; `event` is `:insert`,
`:delete`, or `:update`; `update_columns` is the optional `UPDATE OF`
column-key list. The body is a list of parsed statements executed with
`OLD.`/`NEW.` references substituted per affected row.
"""
defstruct name: nil,
schema: nil,
if_not_exists: false,
timing: :before,
event: nil,
update_columns: nil,
table: nil,
table_schema: nil,
when: nil,
body: []
@type t :: %__MODULE__{
name: String.t(),
schema: String.t() | nil,
if_not_exists: boolean(),
timing: :before | :after | :instead_of,
event: :insert | :delete | :update,
update_columns: [String.t()] | nil,
table: String.t(),
table_schema: String.t() | nil,
when: term() | nil,
body: [term()]
}
end