Support unique groups #2465
DenuxPlays
started this conversation in
Ideas
Replies: 1 comment
-
Maybe the user code could look something like this: #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "users")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: i64,
#[sea_orm(column_type = "Text", unique, unique_group("email-email_verification_token", "email-reset_token"))]
pub email: String,
#[sea_orm(column_type = "Text")]
pub name: String,
pub flags: i32,
#[sea_orm(column_type = "Text")]
pub password: String,
#[sea_orm(column_type = "Text", nullable, unique_group("email-reset_token"))]
pub reset_token: Option<String>,
pub reset_sent_at: Option<DateTimeWithTimeZone>,
#[sea_orm(column_type = "Text", nullable, unique_group("email-email_verification_token"))]
pub email_verification_token: Option<String>,
pub email_verification_sent_at: Option<DateTimeWithTimeZone>,
pub email_verified_at: Option<DateTimeWithTimeZone>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey,
I recently wanted to use a unique group but I don't think that sea-orm supports that.
Here is the PostgreSQL documentation: https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-UNIQUE-CONSTRAINTS
And here is an sql example:
Beta Was this translation helpful? Give feedback.
All reactions