pub trait DdlGenerator {
// Required methods
fn dialect(&self) -> &'static str;
fn generate(&self, op: &SchemaOperation) -> Vec<String>;
// Provided methods
fn generate_all(&self, ops: &[SchemaOperation]) -> Vec<String> { ... }
fn generate_rollback(&self, ops: &[SchemaOperation]) -> Vec<String> { ... }
}Expand description
Generates DDL SQL statements from schema operations.
Required Methods§
Sourcefn generate(&self, op: &SchemaOperation) -> Vec<String>
fn generate(&self, op: &SchemaOperation) -> Vec<String>
Generate DDL statement(s) for a single schema operation.
Some operations (like SQLite DROP COLUMN) may produce multiple statements.
Provided Methods§
Sourcefn generate_all(&self, ops: &[SchemaOperation]) -> Vec<String>
fn generate_all(&self, ops: &[SchemaOperation]) -> Vec<String>
Generate DDL statements for multiple operations.
Sourcefn generate_rollback(&self, ops: &[SchemaOperation]) -> Vec<String>
fn generate_rollback(&self, ops: &[SchemaOperation]) -> Vec<String>
Generate rollback DDL statements (inverse operations).
Returns statements in reverse order, suitable for undoing the original operations. Operations without an inverse (like DROP TABLE) are skipped.