From 360436ceacdc527ed5a3c4006f9fd66460d3c173 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Fri, 24 Sep 2021 15:45:22 +0800 Subject: [PATCH] Codegen compact-format generate unique attribute --- sea-orm-codegen/src/entity/writer.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sea-orm-codegen/src/entity/writer.rs b/sea-orm-codegen/src/entity/writer.rs index edfbef0b2..59f545379 100644 --- a/sea-orm-codegen/src/entity/writer.rs +++ b/sea-orm-codegen/src/entity/writer.rs @@ -346,6 +346,9 @@ impl EntityWriter { attrs.push(quote! { nullable }); } }; + if col.unique { + attrs.push(quote! { unique }); + } if !attrs.is_empty() { let mut ts = TokenStream::new(); for (i, attr) in attrs.into_iter().enumerate() {