This is my schema:
diesel::table! {
account (organization_id) {
#[max_length = 255]
organization_id -> Varchar,
#[max_length = 255]
name -> Varchar,
#[max_length = 255]
description -> Varchar,
account_was_verified -> Bool,
#[max_length = 255]
username -> Varchar,
#[max_length = 255]
password_hash -> Varchar,
}
}
I want the username attribute to be unique when the table is created (that is, having the unique constraint when the migration is generated). Is it possible to do this?
This is not supported.
The Diesel schema definitions are not a one-stop-shop for configuring your database tables. There are many situations where you'd need to manually adjust the auto-generated migrations from diesel; this being one of them.