Skip to content

Commit

Permalink
made enum type TEXT instead of VARCHAR
Browse files Browse the repository at this point in the history
  • Loading branch information
eboody committed Dec 7, 2024
1 parent 8b43734 commit 7466c32
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion macro/src/codegen/insert_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub fn struct_InsertModel(ast: &DeriveInput, attr: &ModelMeta) -> TokenStream {
#vis struct #insert_model {
#(#struct_fields,)*
}
}
}
} else {
quote! {
#[derive(Debug)]
Expand Down
6 changes: 5 additions & 1 deletion macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,11 @@ pub fn derive_ormlite_enum(input: TokenStream) -> TokenStream {

impl sqlx::Type<sqlx::Postgres> for #enum_name {
fn type_info() -> <sqlx::Postgres as sqlx::Database>::TypeInfo {
<String as sqlx::Type<sqlx::Postgres>>::type_info()
sqlx::postgres::PgTypeInfo::with_name("TEXT")
}

fn compatible(ty: &<sqlx::Postgres as sqlx::Database>::TypeInfo) -> bool {
ty.to_string() == "TEXT"
}
}
};
Expand Down

0 comments on commit 7466c32

Please sign in to comment.