The migration method schema::custom() allows defining table columns of a custom type, e.g. enums in PostgreSQL. Right now, its type signature requires both arguments col and name to be of the same type T: IntoIden:
Alternatively, the method schema::custom() can be expanded. When doing so, care must be taken to include the implied constraint not_null() to get the same behaviour:
Description
The migration method
schema::custom()
allows defining table columns of a custom type, e.g. enums in PostgreSQL. Right now, its type signature requires both argumentscol
andname
to be of the same typeT: IntoIden
:https://github.com/SeaQL/sea-orm/blob/aa0bbd9e017635ba646a76e7d7ac4f33bccd5db5/sea-orm-migration/src/schema.rs#L541-L543
This is problematic because it does not allow pulling column name and type name from two different
DeriveIden
structs as in the following example:Steps to Reproduce
Type::create().as_enum(…)
.DeriveIden
structs.Expected Behavior
The call to
schema::custom()
should be valid even when both arguments come from differentDeriveIden
structs.Actual Behavior
The call to
schema::custom()
is rejected.Workarounds
For now, the workaround is to use
Alias
for bothcol
andname
arguments. However, this defeats the purpose of using reusableDeriveIden
structs:Alternatively, the method
schema::custom()
can be expanded. When doing so, care must be taken to include the implied constraintnot_null()
to get the same behaviour:Versions