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

seaorm-cli codegen maps col(big_unsigned(..)) to i64 #2494

Open
CallMeMSL opened this issue Feb 11, 2025 · 0 comments
Open

seaorm-cli codegen maps col(big_unsigned(..)) to i64 #2494

CallMeMSL opened this issue Feb 11, 2025 · 0 comments

Comments

@CallMeMSL
Copy link

Description

table clolumns with big_unsigned type get mapped to an i64 field during entity generation by seaorm-cli

Steps to Reproduce

  1. 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,
}
  1. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant