pub trait NestedSetBlueprint {
// Required methods
fn nested_set(&mut self);
fn nested_set_scoped(&mut self, scope: &[&str]);
fn nested_set_uuid(&mut self);
fn drop_nested_set(&mut self);
fn nested_set_depth(&mut self);
}Expand description
Adds the nested set columns and their index to a table.
use laravel_nestedset::NestedSetBlueprint;
tx.schema()
.create("categories", |table| {
table.id();
table.string("name");
table.nested_set();
table.timestamps();
})
.await?;Required Methods§
Sourcefn nested_set(&mut self)
fn nested_set(&mut self)
Adds lft and rgt (big integers, default 0), a nullable parent_id, and the indexes
the queries and writes use: on lft, rgt, parent_id, on rgt, and on parent_id.
Sourcefn nested_set_scoped(&mut self, scope: &[&str])
fn nested_set_scoped(&mut self, scope: &[&str])
nested_set for a table with several trees: the index starts with
the scope columns, such as ["menu_id"], which the table must already define.
Sourcefn nested_set_uuid(&mut self)
fn nested_set_uuid(&mut self)
nested_set for a model with a UUID key: parent_id is a nullable
UUID.
Sourcefn drop_nested_set(&mut self)
fn drop_nested_set(&mut self)
Drops what nested_set added.
Sourcefn nested_set_depth(&mut self)
fn nested_set_depth(&mut self)
Adds the optional depth column (big integer, default 0) and an index on it. Return it
from NestedSet::depth_column, then run
fix_tree once to fill it on a table that has rows.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".