sea-orm-cli generate error
Open
Nobody has claimed this yet.
Area:code-gen
- Dominant language
- Rust
- Stars
- 9.9k
- Forks
- 734
- Avg merge
- 6h 36m
- Merged PRs (30d)
- 8
Description
When I use a primary key of type string, there is no normal entity generation
sea-orm-cli version:0.12.15
rust:1.77.1
sea-orm-cli generate entity -s public -o test --expanded-format --with-serde both -t wms_warehouse
Connecting to Postgres ...
Discovering schema ...
... discovered.
Generating wms_warehouse.rs
> Column `warehouse_id`: String, not_null
> Column `warehouse_name`: Option<String>
> Column `warehouse_code`: Option<String>
> Column `warehouse_type`: Option<String>
> Column `address`: Option<String>
> Column `address_detail`: Option<String>
> Column `address_ids`: Option<String>
> Column `remark`: Option<String>
> Column `status`: Option<String>
Writing test/wms_warehouse.rs
Writing test/mod.rs
Writing test/prelude.rs
Warning: can't set `wrap_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `format_code_in_doc_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `normalize_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `imports_granularity = Crate`, unstable features are only available in nightly channel.
Warning: can't set `group_imports = StdExternalCrate`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
error: expected type, found `;`
--> /Users/wufei/item/rust/miaojue-erp/test/wms_warehouse.rs:17:56
|
17 | impl PrimaryKeyTrait for PrimaryKey { type ValueType = ; fn auto_increment () -> bool { false } }
| - ^ expected type - the item list ends here
| |
| while parsing this item list starting here
Fail to format file `wms_warehouse.rs`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the sea-orm-cli generate entity command against a PostgreSQL table with a string primary key, then inspect the generated test/wms_warehouse.rs, especially the PrimaryKeyTrait implementation at line 17. Trace the entity-generation path that produces the empty ValueType; done means valid Rust is generated and formatting completes without the reported parse error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, rust
- Domain
- cli, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100