| Crates.io | ignis-db |
| lib.rs | ignis-db |
| version | 0.2.0 |
| created_at | 2025-09-09 18:43:27.813209+00 |
| updated_at | 2025-09-10 13:10:08.251568+00 |
| description | A comprehensive PostgreSQL ORM with macro-driven schema management |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1831389 |
| size | 2,813,348 |
A PostgreSQL ORM and database management tool for Rust.
Ignis-DB provides:
Ignis-DB provides a comprehensive set of declarative macros for defining database schemas:
table! - Define tables with columns, constraints, and indexesview! - Create standard and materialized viewscomposite! - Define PostgreSQL composite typesindex! - Create database indexes with various types and optionstrigger! - Define database triggers with timing and eventsprocedure! - Create stored procedures with parametersfunction! - Define database functionsevent! - Schedule database events and jobsrole! - Define database roles and usersgrant! - Manage permissions and access controlimpl_ignis_model! - Implement IgnisModel trait for structsimpl_insertable! - Add insert operations to modelsimpl_updatable! - Add update operations to modelsimpl_deletable! - Add delete operations to modelsinit: Initialize project from existing databaseintrospect: Analyze database schemamigrate: Manage database migrationsscaffold: Generate code for specific tablessync: Synchronize Rust models with databasecargo install --path .
ignis-cli init --database-url "postgresql://user:pass@localhost/db" --output ./my_project
ignis-cli introspect --database-url "postgresql://user:pass@localhost/db"
ignis-cli sync --database-url "postgresql://user:pass@localhost/db" --src ./src/models
git clone <repository>
cd ignis-db
cargo build
# Start test database
docker-compose up -d
# Run tests
cargo test
src/
├── bin/ # CLI application
├── schema/ # Database schema definitions
├── migrate/ # Migration system
├── introspection/ # Database introspection
├── codegen/ # Code generation
├── code_parsing/ # Rust code parsing
└── macros/ # Declarative schema definition macros
See the examples/ directory for usage examples covering:
use ignis_db::*;
// Define a table with columns and constraints
table! {
users {
id -> Int4,
username -> Varchar,
email -> Varchar,
created_at -> Timestamptz,
// Constraints
primary_key(id),
unique(username),
unique(email),
not_null(username),
not_null(email),
}
}
// Create a view
view! {
active_users {
SELECT id, username, email
FROM users
WHERE created_at > NOW() - INTERVAL '30 days'
}
}
// Define a composite type
composite! {
address {
street -> Varchar,
city -> Varchar,
zip_code -> Varchar,
country -> Varchar,
}
}
// Create a trigger
trigger! {
users_audit ON users
AFTER INSERT OR UPDATE OR DELETE
FOR EACH ROW
EXECUTE FUNCTION audit_users_changes()
}
// Define a stored procedure
procedure! {
create_user(username: Varchar, email: Varchar) -> Int4 {
INSERT INTO users (username, email, created_at)
VALUES ($1, $2, NOW())
RETURNING id
}
}
MIT OR Apache-2.0