Skip to main content

NestedSetBlueprint

Trait NestedSetBlueprint 

Source
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§

Source

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.

Source

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.

Source

fn nested_set_uuid(&mut self)

nested_set for a model with a UUID key: parent_id is a nullable UUID.

Source

fn drop_nested_set(&mut self)

Drops what nested_set added.

Source

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".

Implementations on Foreign Types§

Source§

impl NestedSetBlueprint for Blueprint

Source§

fn nested_set(&mut self)

Source§

fn nested_set_uuid(&mut self)

Source§

fn nested_set_scoped(&mut self, scope: &[&str])

Source§

fn nested_set_depth(&mut self)

Source§

fn drop_nested_set(&mut self)

Implementors§