diff --git a/.gitignore b/.gitignore index 73bd6e3..4e2963e 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ Cargo.lock migrations out + +.idea/ diff --git a/src/main.rs b/src/main.rs index 7a8aa53..e5c0948 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,6 +27,10 @@ struct Cli { #[arg(long, value_name = "SQLGEN_INCLUDE_TABLES", value_delimiter = ',')] include_tables: Option>, + /// PostgreSQL schemas to include (defaults to "public"). + #[arg(long, value_name = "SQLGEN_SCHEMAS", value_delimiter = ',')] + schemas: Option>, + /// Enum derives to add (can be used multiple times). #[arg( long = "enum-derive", @@ -109,9 +113,11 @@ async fn generate_rust_from_database(args: &Cli) -> DbSetsFsWriter { .await .unwrap(); + let schemas = args.schemas.clone().unwrap_or_else(|| vec![String::from("public")]); + let tables = postgres::queries::get_tables::get_tables( &pool, - &[String::from("public")], + &schemas, &args.include_tables, ) .await