You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I create an sqlite database with id INTEGER PRIMARY KEY AUTOINCREMENT, and then run sea-orm-cli generate entity, I get a
Steps to Reproduce
Initialize a cargo project called test_id. All paths and commands are from the root of that project.
Cargo.toml should contain:
[package]
name = "test_id"
version = "0.1.0"
edition = "2021"
[dependencies]
sea-orm = "0.12.10" # Check for the latest version
tokio = { version = "1", features = ["full"] }
Create a sqlite3 database in db/sqlite.db with only the following table:
CREATE TABLE IF NOT EXISTS "tasks" (
id INTEGER PRIMARY KEY AUTOINCREMENT,
task_num INTEGER NOT NULL UNIQUE
);
Run sea-orm-cli generate entity -o src/entities -u sqlite://db/sqlite.db
Create src/main.rs with the contents:
mod entities;
#[tokio::main]
async fn main() {
Run cargo build
Expected Behavior
It's supposed to compile successfully.
Actual Behavior
We get the following error:
Compiling test_id v0.1.0 (/Users/garyrob/Source/myrust/test_id)
error[E0277]: the trait bound `Option<i32>: sea_orm::ActiveEnum` is not satisfied
--> src/entities/tasks.rs:9:13
|
9 | pub id: Option<i32>,
| ^^^^^^^^^^^ the trait `sea_orm::ActiveEnum` is not implemented for `Option<i32>`
|
= help: the following other types implement trait `TryFromU64`:
bool
i8
i16
i32
i64
u8
u16
u32
and 29 others
= note: required for `Option<i32>` to implement `TryFromU64`
note: required by a bound in `sea_orm::PrimaryKeyTrait::ValueType`
--> /Users/garyrob/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-orm-0.12.10/src/entity/primary_key.rs:49:11
|
42 | type ValueType: Sized
| --------- required by a bound in this associated type
...
49 | + TryFromU64;
| ^^^^^^^^^^ required by this bound in `PrimaryKeyTrait::ValueType`
For more information about this error, try `rustc --explain E0277`.
error: could not compile `test_id` (bin "test_id") due to previous error
Reproduces How Often
Every time.
Workarounds
None known if we want the primary key to be auto-increment.
Description
If I create an sqlite database with
id INTEGER PRIMARY KEY AUTOINCREMENT
, and then runsea-orm-cli generate entity
, I get aSteps to Reproduce
Initialize a cargo project called test_id. All paths and commands are from the root of that project.
Cargo.toml should contain:
db/sqlite.db
with only the following table:cargo build
Expected Behavior
It's supposed to compile successfully.
Actual Behavior
We get the following error:
Reproduces How Often
Every time.
Workarounds
None known if we want the primary key to be auto-increment.
Reproducible Example
Versions
The text was updated successfully, but these errors were encountered: