pub struct RenameHints {
pub fields: BTreeMap<(String, String), String>,
pub models: BTreeMap<String, String>,
pub allow_model_drops: BTreeSet<String>,
pub allow_field_drops: BTreeSet<(String, String)>,
}Expand description
Explicit rename pairs, plus explicit drop approvals.
The autodetector never infers renames from similarity; a missing hint
becomes remove+add (and is refused when the two sides have the same
shape). When the drop is intentional, approve it with
allow_drop_model /
allow_drop_field instead of splitting the
change across two migrations.
Fields§
§fields: BTreeMap<(String, String), String>(model_name, old_field_name) → new_field_name.
models: BTreeMap<String, String>old_model_name → new_model_name.
allow_model_drops: BTreeSet<String>from-side model names that may be deleted even when a same-shaped
model is created.
allow_field_drops: BTreeSet<(String, String)>(model_name, field_name) pairs on the from side that may be
removed even when a same-shaped field is added.
Implementations§
Source§impl RenameHints
impl RenameHints
Sourcepub fn rename_field(
self,
model: impl Into<String>,
old_name: impl Into<String>,
new_name: impl Into<String>,
) -> Self
pub fn rename_field( self, model: impl Into<String>, old_name: impl Into<String>, new_name: impl Into<String>, ) -> Self
Record that model.old_name became new_name.
Sourcepub fn rename_model(
self,
old_name: impl Into<String>,
new_name: impl Into<String>,
) -> Self
pub fn rename_model( self, old_name: impl Into<String>, new_name: impl Into<String>, ) -> Self
Record that model old_name became new_name.
Sourcepub fn allow_drop_model(self, name: impl Into<String>) -> Self
pub fn allow_drop_model(self, name: impl Into<String>) -> Self
Approve deleting model name even when a same-shaped model is
created in the same diff. Use this when the drop is intentional and
the new model is genuinely unrelated (the autodetector cannot tell
that apart from a rename, so it refuses without an explicit answer).
Trait Implementations§
Source§impl Clone for RenameHints
impl Clone for RenameHints
Source§fn clone(&self) -> RenameHints
fn clone(&self) -> RenameHints
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RenameHints
impl Debug for RenameHints
Source§impl Default for RenameHints
impl Default for RenameHints
Source§fn default() -> RenameHints
fn default() -> RenameHints
impl Eq for RenameHints
Source§impl PartialEq for RenameHints
impl PartialEq for RenameHints
impl StructuralPartialEq for RenameHints
Auto Trait Implementations§
impl Freeze for RenameHints
impl RefUnwindSafe for RenameHints
impl Send for RenameHints
impl Sync for RenameHints
impl Unpin for RenameHints
impl UnsafeUnpin for RenameHints
impl UnwindSafe for RenameHints
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.