Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/codegen/overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ mod tests {
enable_lineage: true,
enable_temporal: true,
enable_access_control: true,
enable_constraints: true,
enable_simulation: true,
};
let ddl = generate_sidecar_schema(&schema, &octad);
Expand All @@ -309,6 +310,7 @@ mod tests {
enable_lineage: false,
enable_temporal: false,
enable_access_control: false,
enable_constraints: false,
enable_simulation: false,
};
let ddl = generate_sidecar_schema(&schema, &octad);
Expand Down
14 changes: 12 additions & 2 deletions src/codegen/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ mod tests {
enable_lineage: true,
enable_temporal: true,
enable_access_control: true,
enable_constraints: true,
enable_simulation: false,
};
let interceptors = generate_interceptors(&schema, &octad, DatabaseBackend::SQLite);
Expand All @@ -364,6 +365,7 @@ mod tests {
enable_lineage: false,
enable_temporal: false,
enable_access_control: false,
enable_constraints: false,
enable_simulation: false,
};
let interceptors = generate_interceptors(&schema, &octad, DatabaseBackend::SQLite);
Expand All @@ -384,11 +386,15 @@ mod tests {
enable_lineage: false,
enable_temporal: false,
enable_access_control: false,
enable_constraints: false,
enable_simulation: false,
};
let interceptors = generate_interceptors(&schema, &octad, DatabaseBackend::SQLite);

let view = interceptors[0].provenance_view.as_ref().expect("TODO: handle error");
let view = interceptors[0]
.provenance_view
.as_ref()
.expect("TODO: handle error");
assert!(view.contains("verisimdb_posts_with_provenance"));
assert!(view.contains("posts.id"));
assert!(view.contains("posts.title"));
Expand All @@ -403,11 +409,15 @@ mod tests {
enable_lineage: false,
enable_temporal: true,
enable_access_control: false,
enable_constraints: false,
enable_simulation: false,
};
let interceptors = generate_interceptors(&schema, &octad, DatabaseBackend::SQLite);

let view = interceptors[0].temporal_view.as_ref().expect("TODO: handle error");
let view = interceptors[0]
.temporal_view
.as_ref()
.expect("TODO: handle error");
assert!(view.contains("verisimdb_posts_with_temporal"));
assert!(view.contains("verisimdb_temporal_versions"));
assert!(view.contains("valid_to IS NULL"));
Expand Down
19 changes: 14 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ enum Commands {
/// Database backend: postgresql, sqlite, or mongodb.
#[arg(short, long, default_value = "postgresql")]
database: String,
/// Project name (default: "my-augmented-db").
#[arg(short, long)]
name: Option<String>,
/// Overwrite an existing verisimiser.toml.
#[arg(short, long)]
force: bool,
},
/// Parse the target database schema and generate sidecar overlay + interceptors.
Generate {
Expand Down Expand Up @@ -86,7 +92,11 @@ enum Commands {
fn main() -> Result<()> {
let cli = Cli::parse();
match cli.command {
Commands::Init { database } => manifest::init_manifest(&database),
Commands::Init {
database,
name,
force,
} => manifest::init_manifest(&database, name.as_deref(), force),

Commands::Generate { manifest, output } => {
let m = manifest::load_manifest(&manifest)?;
Expand All @@ -104,7 +114,7 @@ fn main() -> Result<()> {
};

// Determine the backend for SQL dialect selection.
let backend_name = m.database.effective_backend();
let backend_name = m.database.effective_backend()?;
let backend = abi::DatabaseBackend::from_str(backend_name)
.unwrap_or(abi::DatabaseBackend::PostgreSQL);

Expand Down Expand Up @@ -139,7 +149,7 @@ fn main() -> Result<()> {
} else {
&m.verisimiser.name
};
let backend = m.database.effective_backend();
let backend = m.database.effective_backend()?;
println!(
"Starting VeriSimiser augmentation for {} ({})",
name, backend
Expand Down Expand Up @@ -183,8 +193,7 @@ fn main() -> Result<()> {

Commands::Status { manifest } => {
let m = manifest::load_manifest(&manifest)?;
manifest::print_status(&m);
Ok(())
manifest::print_status(&m)
}

Commands::Octad => {
Expand Down
Loading
Loading