seaorm-cli codegen maps col(big_unsigned(..)) to i64
Open
Beginner friendly
Nobody has claimed this yet.
Area:schema
help-wanted
- Dominant language
- Rust
- Stars
- 9.9k
- Forks
- 735
- Avg merge
- 6h 36m
- Merged PRs (30d)
- 8
Description
Description
table clolumns with big_unsigned type get mapped to an i64 field during entity generation by seaorm-cli
Steps to Reproduce
- create a Table in a migration up with a BigUnsigned column
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.create_table(
Table::create()
.table(User::Table)
.if_not_exists()
.col(pk_auto(User::Id))
.col(big_unsigned(User::DiscordId))
.to_owned(),
)
.await
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.drop_table(Table::drop().table(User::Table).to_owned())
.await
}
}
#[derive(DeriveIden)]
enum User {
Table,
Id,
DiscordId,
}
- run
sea-orm-cli generate entity -o entity/src -l
generated user.rs:
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.4
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "user")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub discord_id: i64,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}
impl ActiveModelBehavior for ActiveModel {}
Expected Behavior
pub discord_id: u64 in generated entity
Actual Behavior
pub discord_id: i64 in generated entity
Reproduces How Often
every time
Workarounds
Reproducible Example
see above
Versions
1.1.4
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 issue with the shown migration and the sea-orm-cli generate entity -o entity/src -l entry point. Compare the generated user.rs model with the migration's big_unsigned column; done means the generated discord_id field uses u64 instead of i64.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, database
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 70/100