pub struct RenameHints { /* private fields */ }Expand description
Hints that tell the diff algorithm which schema items were renamed.
Without rename hints, a renamed table/column/index appears as a drop followed by a create. Adding a hint maps the old ID to the new ID so the diff produces an alter instead.
§Examples
ⓘ
use toasty_core::schema::db::{RenameHints, TableId};
let mut hints = RenameHints::new();
hints.add_table_hint(TableId(0), TableId(1));
assert_eq!(hints.get_table(TableId(0)), Some(TableId(1)));
assert_eq!(hints.get_table(TableId(2)), None);Implementations§
Source§impl RenameHints
impl RenameHints
Sourcepub fn add_table_hint(&mut self, from: TableId, to: TableId)
pub fn add_table_hint(&mut self, from: TableId, to: TableId)
Records that the table previously identified by from is now identified by to.
Sourcepub fn add_column_hint(&mut self, from: ColumnId, to: ColumnId)
pub fn add_column_hint(&mut self, from: ColumnId, to: ColumnId)
Records that the column previously identified by from is now identified by to.
Sourcepub fn add_index_hint(&mut self, from: IndexId, to: IndexId)
pub fn add_index_hint(&mut self, from: IndexId, to: IndexId)
Records that the index previously identified by from is now identified by to.
Sourcepub fn get_table(&self, from: TableId) -> Option<TableId>
pub fn get_table(&self, from: TableId) -> Option<TableId>
Returns the new TableId if a rename hint exists for from.
Trait Implementations§
Source§impl Default for RenameHints
impl Default for RenameHints
Source§fn default() -> RenameHints
fn default() -> RenameHints
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RenameHints
impl RefUnwindSafe for RenameHints
impl Send for RenameHints
impl Sync for RenameHints
impl Unpin 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
Mutably borrows from an owned value. Read more