surql_parser/upstream/sql/statements/alter/database.rs
1use surrealdb_types::{SqlFormat, ToSql, write_sql};
2#[derive(Clone, Debug, Default, Eq, PartialEq)]
3/// AST node for `ALTER DATABASE`.
4///
5/// Currently supports the `COMPACT` maintenance operation, which instructs the
6/// underlying datastore to compact the current database keyspace.
7pub struct AlterDatabaseStatement {
8 pub compact: bool,
9}
10impl ToSql for AlterDatabaseStatement {
11 fn fmt_sql(&self, f: &mut String, _fmt: SqlFormat) {
12 write_sql!(f, _fmt, "ALTER DATABASE");
13 if self.compact {
14 write_sql!(f, _fmt, " COMPACT");
15 }
16 }
17}