pub trait MigrationDialect {
Show 21 methods
// Required methods
fn name(&self) -> &'static str;
fn rename_table(&self, op: &RenameTableOp) -> String;
fn alter_column(&self, op: &AlterColumnOp) -> String;
fn rename_column(&self, op: &RenameColumnOp) -> String;
fn drop_index(&self, op: &DropIndexOp) -> String;
fn drop_foreign_key(&self, op: &DropForeignKeyOp) -> String;
fn map_data_type(&self, dt: &DataType) -> String;
fn autoincrement_keyword(&self) -> String;
// Provided methods
fn generate_sql(&self, operation: &Operation) -> String { ... }
fn create_table(&self, op: &CreateTableOp) -> String { ... }
fn drop_table(&self, op: &DropTableOp) -> String { ... }
fn add_column(&self, op: &AddColumnOp) -> String { ... }
fn drop_column(&self, op: &DropColumnOp) -> String { ... }
fn create_index(&self, op: &CreateIndexOp) -> String { ... }
fn add_foreign_key(&self, op: &AddForeignKeyOp) -> String { ... }
fn column_definition(&self, col: &ColumnDefinition) -> String { ... }
fn table_constraint(&self, constraint: &TableConstraint) -> String { ... }
fn render_default(&self, default: &DefaultValue) -> String { ... }
fn quote_char(&self) -> char { ... }
fn quote_identifier(&self, name: &str) -> String { ... }
fn index_type_sql(&self, index_type: &IndexType) -> &'static str { ... }
}Expand description
Trait for dialect-specific SQL generation for migrations.
Required Methods§
Sourcefn rename_table(&self, op: &RenameTableOp) -> String
fn rename_table(&self, op: &RenameTableOp) -> String
Generates SQL for RENAME TABLE.
Sourcefn alter_column(&self, op: &AlterColumnOp) -> String
fn alter_column(&self, op: &AlterColumnOp) -> String
Generates SQL for ALTER COLUMN.
Sourcefn rename_column(&self, op: &RenameColumnOp) -> String
fn rename_column(&self, op: &RenameColumnOp) -> String
Generates SQL for RENAME COLUMN.
Sourcefn drop_index(&self, op: &DropIndexOp) -> String
fn drop_index(&self, op: &DropIndexOp) -> String
Generates SQL for DROP INDEX.
Sourcefn drop_foreign_key(&self, op: &DropForeignKeyOp) -> String
fn drop_foreign_key(&self, op: &DropForeignKeyOp) -> String
Generates SQL for DROP FOREIGN KEY.
Sourcefn map_data_type(&self, dt: &DataType) -> String
fn map_data_type(&self, dt: &DataType) -> String
Maps a DataType to the dialect-specific SQL type.
Sourcefn autoincrement_keyword(&self) -> String
fn autoincrement_keyword(&self) -> String
Returns the AUTOINCREMENT keyword for this dialect.
Provided Methods§
Sourcefn generate_sql(&self, operation: &Operation) -> String
fn generate_sql(&self, operation: &Operation) -> String
Generates SQL for an operation.
Sourcefn create_table(&self, op: &CreateTableOp) -> String
fn create_table(&self, op: &CreateTableOp) -> String
Generates SQL for CREATE TABLE.
Sourcefn drop_table(&self, op: &DropTableOp) -> String
fn drop_table(&self, op: &DropTableOp) -> String
Generates SQL for DROP TABLE.
Sourcefn add_column(&self, op: &AddColumnOp) -> String
fn add_column(&self, op: &AddColumnOp) -> String
Generates SQL for ADD COLUMN.
Sourcefn drop_column(&self, op: &DropColumnOp) -> String
fn drop_column(&self, op: &DropColumnOp) -> String
Generates SQL for DROP COLUMN.
Sourcefn create_index(&self, op: &CreateIndexOp) -> String
fn create_index(&self, op: &CreateIndexOp) -> String
Generates SQL for CREATE INDEX.
Sourcefn add_foreign_key(&self, op: &AddForeignKeyOp) -> String
fn add_foreign_key(&self, op: &AddForeignKeyOp) -> String
Generates SQL for ADD FOREIGN KEY.
Sourcefn column_definition(&self, col: &ColumnDefinition) -> String
fn column_definition(&self, col: &ColumnDefinition) -> String
Generates SQL for a column definition.
Sourcefn table_constraint(&self, constraint: &TableConstraint) -> String
fn table_constraint(&self, constraint: &TableConstraint) -> String
Generates SQL for a table constraint.
Sourcefn render_default(&self, default: &DefaultValue) -> String
fn render_default(&self, default: &DefaultValue) -> String
Renders a default value.
Sourcefn quote_char(&self) -> char
fn quote_char(&self) -> char
Returns the identifier quote character.
Sourcefn quote_identifier(&self, name: &str) -> String
fn quote_identifier(&self, name: &str) -> String
Quotes an identifier.
Sourcefn index_type_sql(&self, index_type: &IndexType) -> &'static str
fn index_type_sql(&self, index_type: &IndexType) -> &'static str
Maps an index type to SQL.