pub struct Generator {
pub breakpoints: bool,
}Available on crate feature
std only.Fields§
§breakpoints: boolImplementations§
Source§impl Generator
impl Generator
pub const fn new() -> Generator
pub const fn with_breakpoints(self, breakpoints: bool) -> Generator
Sourcepub fn generate(&self, diff: &[EntityDiff]) -> Vec<String>
pub fn generate(&self, diff: &[EntityDiff]) -> Vec<String>
Generate SQL statements from a set of entity diffs.
§Panics
Panics if a table listed in created_tables is not found in diff
— this cannot happen in practice because created_tables is built
from diff itself.
Sourcepub fn generate_with_ddl(
&self,
diff: &[EntityDiff],
cur_ddl: Option<&PostgresDDL>,
) -> Vec<String>
pub fn generate_with_ddl( &self, diff: &[EntityDiff], cur_ddl: Option<&PostgresDDL>, ) -> Vec<String>
Generate SQL statements from a set of entity diffs, with access to the full current DDL for cross-entity lookups (e.g. finding the columns that depend on an enum being recreated).
Statement ordering is dependency-phased:
- creates of schemas → enums → sequences → roles,
- drops of views,
- drops of table sub-entities on surviving tables (FKs/indexes/constraints/policies before columns),
- table drops in reverse dependency order,
- table creates in dependency order (with inlined sub-entities),
- sub-entity creates on pre-existing tables (columns first),
- alters (including
ALTER COLUMN ... USINGenum conversions), - enum and sequence drops (after alters so
USINGcasts run beforeDROP TYPE), - view creates,
- role and schema drops.
§Panics
Panics if a table listed in created_tables is not found in diff
— this cannot happen in practice because created_tables is built
from diff itself.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Generator
impl RefUnwindSafe for Generator
impl Send for Generator
impl Sync for Generator
impl Unpin for Generator
impl UnsafeUnpin for Generator
impl UnwindSafe for Generator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more