Allow distinct types in schema::custom() (#2326)

* Allow distinct types in schema::custom()

* Allow `custom_null` to take column name and alias of different `IntoIden` types

---------

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
This commit is contained in:
Sebastian Goll 2024-10-04 11:41:46 +02:00 committed by GitHub
parent cb5520eb67
commit 31ef8c76df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -543,11 +543,11 @@ pub fn uuid_uniq<T: IntoIden>(col: T) -> ColumnDef {
uuid(col).unique_key().take() uuid(col).unique_key().take()
} }
pub fn custom<T: IntoIden>(col: T, name: T) -> ColumnDef { pub fn custom<T: IntoIden, N: IntoIden>(col: T, name: N) -> ColumnDef {
ColumnDef::new(col).custom(name).not_null().take() ColumnDef::new(col).custom(name).not_null().take()
} }
pub fn custom_null<T: IntoIden>(col: T, name: T) -> ColumnDef { pub fn custom_null<T: IntoIden, N: IntoIden>(col: T, name: N) -> ColumnDef {
ColumnDef::new(col).custom(name).null().take() ColumnDef::new(col).custom(name).null().take()
} }