toasty_sql/stmt/
drop_index.rs1use super::{Name, Statement};
2
3use toasty_core::schema::db::Index;
4
5#[derive(Debug, Clone)]
7pub struct DropIndex {
8 pub name: Name,
10
11 pub if_exists: bool,
13}
14
15impl Statement {
16 pub fn drop_index(index: &Index) -> Self {
20 DropIndex {
21 name: Name::from(&index.name[..]),
22 if_exists: false,
23 }
24 .into()
25 }
26
27 pub fn drop_index_if_exists(index: &Index) -> Self {
31 DropIndex {
32 name: Name::from(&index.name[..]),
33 if_exists: true,
34 }
35 .into()
36 }
37}
38
39impl From<DropIndex> for Statement {
40 fn from(value: DropIndex) -> Self {
41 Self::DropIndex(value)
42 }
43}