use ignis_db::builders::SchemaBuilder;
use ignis_db::{Deletable, IgnisModel, Insertable, Updatable};
#[derive(IgnisModel, Insertable, Updatable, Deletable)]
#[ignis(table = "sync_macro_users", pk = "id")]
pub struct SyncMacroUser {
pub id: i32,
pub name: String,
pub email: String,
}
pub fn create_sync_builder_table() -> ignis_db::schema::Table {
use ignis_db::builders::{ColumnBuilder, TableBuilder};
use ignis_db::schema::ColumnType;
TableBuilder::new("sync_builder_users")
.column(ColumnBuilder::new("id", ColumnType::Int4).primary_key())
.column(ColumnBuilder::new(
"username",
ColumnType::Varchar(Some(100)),
))
.column(ColumnBuilder::new("email", ColumnType::Varchar(Some(255))))
.build()
.unwrap()
}
pub fn create_sync_products_table() -> ignis_db::schema::Table {
use ignis_db::builders::{ColumnBuilder, TableBuilder};
use ignis_db::schema::ColumnType;
TableBuilder::new("sync_products")
.column(ColumnBuilder::new("sku", ColumnType::Varchar(Some(50))).primary_key())
.column(ColumnBuilder::new("name", ColumnType::Varchar(Some(200))))
.column(ColumnBuilder::new(
"price",
ColumnType::Numeric(Some(10), Some(2)),
))
.build()
.unwrap()
}
pub fn test_compilation() {
let _user = SyncMacroUser {
id: 1,
name: "Test".to_string(),
email: "test@example.com".to_string(),
};
let _table1 = create_sync_builder_table();
let _table2 = create_sync_products_table();
println!("✅ All models compile successfully!");
}
fn main() {
test_compilation();
}