Module templates

Source
Expand description

Common migration templates

Pre-built migration templates for common database operations like creating tables, adding columns, creating indexes, etc. These templates provide a quick way to generate migrations for standard operations.

§Examples

use libsql_orm::templates;

// Create a new table
let create_table = templates::create_table("users", &[
    ("id", "INTEGER PRIMARY KEY AUTOINCREMENT"),
    ("name", "TEXT NOT NULL"),
    ("email", "TEXT UNIQUE NOT NULL"),
]);

// Add a column to existing table
let add_column = templates::add_column("users", "created_at", "TEXT NOT NULL");

// Create an index
let create_index = templates::create_index("idx_users_email", "users", &["email"]);

Functions§

add_column
Add column migration
create_index
Create index migration
create_table
Create a table migration
drop_column
Drop column migration
drop_index
Drop index migration