1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use crate::common::FQName;
use std::fmt::{Display, Formatter};

/// The data for a `drop trigger` command
#[derive(PartialEq, Debug, Clone)]
pub struct DropTrigger {
    /// the name of the trigger
    pub name: FQName,
    /// the table the trigger is associated with.
    pub table: FQName,
    /// only drop if the trigger exists
    pub if_exists: bool,
}

impl Display for DropTrigger {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        write!(
            f,
            "DROP TRIGGER{} {} ON {}",
            if self.if_exists { " IF EXISTS" } else { "" },
            self.name,
            self.table
        )
    }
}