Skip to main content

surrealdb_sql/statements/alter/
database.rs

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