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