Open cxgreat2014 opened 5 months ago
Fix method:
sea-schema/src/sqlite/discovery.rs:23:
pub async fn discover(&self, ignore_tables: Vec<String>) -> DiscoveryResult<Schema> {
let get_tables = SelectStatement::new()
.column(Alias::new("name"))
.from(SqliteMaster)
.and_where(Expr::col(Alias::new("type")).eq("table"))
.and_where(Expr::col(Alias::new("name")).ne("sqlite_sequence"))
.and_where(Expr::col(Alias::new("name")).is_not_in(ignore_tables))
.to_owned();
sea-orm-cli/src/commands/generate.rs:78
let ignore_tables_clone = ignore_tables.clone();
let filter_skip_tables = |table: &String| -> bool { !ignore_tables_clone.contains(table) };
sea-orm-cli/src/commands/generate.rs:139
let schema = schema_discovery.discover(ignore_tables).await?;
Thank you for your report. Seems like you have a proposed fix. Can you open a PR?
My fixes are superficial and not fully tested, and in the case of non-sqlite database branches there is no compatibility processing. The current code logic changes will significantly lower the current code quality. I hope that some sea-orm members can understand the problem more quickly and know a dirty hack fix based on the information I provided above. Then make a good design and submit clean fix code and test files to solve this problem,(which means a lot of work and takes a lot of time and I can't do it at present), so I hope there are more kind people like you to do this PR
Description
Encountering an issue (refer to GitHub issue #123), I aimed to exclude specific tables during entity generation. However, despite utilizing the
--ignore-tables
flag, the entity generation process failed without skipping the specified tables.Steps to Reproduce
Execute the following command:
Check the log for details:
Expected Behavior
Actual Behavior
Reproduces How Often
Workarounds
Reproducible Example
Versions