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 generates wrong datatype for nullable blob #490

Closed
manuel-kolm opened this issue Jan 26, 2022 · 1 comment · Fixed by SeaQL/sea-schema#44
Closed

sea-orm-cli generates wrong datatype for nullable blob #490

manuel-kolm opened this issue Jan 26, 2022 · 1 comment · Fixed by SeaQL/sea-schema#44
Milestone

Comments

@manuel-kolm
Copy link

I'm using sea-orm-cli to generate my entities for this table:

CREATE TABLE "DocumentData" (
	"DocumentDataId"	INTEGER NOT NULL,
	"DocumentId"	TEXT NOT NULL,
	"Data"	BLOB,
	PRIMARY KEY("DocumentDataId")
)

and the generated entity looks like this:

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "DocumentData")]
pub struct Model {
    #[sea_orm(column_name = "DocumentDataId", primary_key, auto_increment = false)]
    pub document_data_id: i32,
    #[sea_orm(column_name = "DocumentId")]
    pub document_id: String,
    #[sea_orm(column_name = "Data", column_type = "Custom(\"BLOB\".to_owned())", nullable)]
    pub data: Option<String>,
}

According to the documentation, the cli will convert a BLOB into aVec<u8>. Since this is a nullable field it should be Option<Vec<u8>> and not Option<String>

Thanks!

@billy1624
Copy link
Member

Hey @manuel-kolm, welcome and you just open your first issue on GitHub :P
Thanks for the report, I will look into it :)

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

Successfully merging a pull request may close this issue.

2 participants