Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sea-orm-cli generate entity --tables argument doesn't work as described #1243

Closed
johnbcodes opened this issue Nov 22, 2022 · 4 comments · Fixed by #1245
Closed

sea-orm-cli generate entity --tables argument doesn't work as described #1243

johnbcodes opened this issue Nov 22, 2022 · 4 comments · Fixed by #1245
Assignees

Comments

@johnbcodes
Copy link

johnbcodes commented Nov 22, 2022

Description

sea-orm-cli generate entity --tables says that it takes a comma-separated list of tables to generate entities for.

    -t, --tables <TABLES>
            Generate entity file for specified tables only (comma separated)

However, the Clap definition uses Option<String> instead of Vec<String>. All tables after the first comma are ignored.

If the intent is to support multiple tables, the change is small and doesn't harm the single table use case. If the intent is to only generate a single entity, then I think the help should be updated. Either way I'm willing to do the work once I know.

Steps to Reproduce

  1. Create a database with ledger_entries and checks tables
  2. Execute sea-orm-cli generate entity -u <DATABASE_URL> --tables ledger_entries,checks -o src/entities

Expected Behavior

Generates entities for the ledger_entries and checks tables

Actual Behavior

Only generates entity for ledger_entries

Reproduces How Often

Always

Versions

0.10.3
SQLite
Mac OS 12.6

@tyt2y3
Copy link
Member

tyt2y3 commented Nov 23, 2022

It should be able to support multiple tables AFAIK @billy1624

@billy1624 billy1624 self-assigned this Nov 23, 2022
@billy1624 billy1624 moved this to Triage in SeaQL Dev Tracker Nov 23, 2022
@billy1624
Copy link
Member

Hey @johnbcodes, thanks for the report!! I'm not sure why it was originally be implemented this way. The original approach takes a comma separated table name and then conditionally generate entity of those with table name is a substring of the comma separated input.

That means, if you have tables user, user_group and group in your database. Then, given your comma separated input be user. It will generate the entity file for user and user_group tables.

Which isn't what we want!

@billy1624
Copy link
Member

I just fix the issue on #1245

@johnbcodes
Copy link
Author

Thank you @billy1624 @tyt2y3!

@billy1624 billy1624 moved this from Triage to Done in SeaQL Dev Tracker Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants